How do you remove the limit on the number of keys at the javascript?



  • Now, with the addition of 48 million keys to the asMap facility, the code hangs, no mistakes. Is there any way to remove the restriction so that billions of keys can be added?

    let cicles = 0;
    const asMap = {};
    

    result.map((item) => {
    const k_ = Object.keys(item);
    let str = '';

    for (let i = 0; i < k_.length; i++) {
      str += `${item[k_[i]]}_`;
      cicles++;
    }
    
    asMap[str] = item;
    if(cicles % 100000 === 0){
      console.log('result3 map cicles='+cicles);
    }
    

    });

    I'm asking you:

    What should be done to ensure that the addition of several million keys to the regular javascript facility does not result in the obsession of nodejs process? No other designs. The specific issue of the object that is created through the instruction

       let asMap = {};



  • Just like the guitar:

    map = Object.create(null);
    ...
    (map[key.slice(0, 2)] ||= Object.create(null))[key] = smth;
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2