title: JS: Benchmark a Bidirectional Map algorithm
body: <p>I've implemented a kind of Bidirectional Map in JS. It can store two lists (left and right) and can store relations between two sides, holding additional data. Example :</p>
  
  <pre><code>let ingredients = 'apple chocolate vanilla'.split(' ')
  let desserts = 'cheesecake blackforest'.split(' ')
  
  ingredients.forEach((i) =&gt; { bdm.ladd(i, i)})
  desserts.forEach((d) =&gt; { bdm.radd(d, d)})
  
  bdm.join('apple', 'cheesecake', '4')
  bdm.join('chocolate', 'blackforest', '200g')
  bdm.join('vanilla', 'cheesecake', '1g')
  bdm.join('vanilla', 'blackforest', '2.5g')
  
  // query again structure
  bdm.seek('vanilla', null, (assoc) =&gt; { console.log(assoc) })
  
  // output:
  // { left: 'vanilla', right: 'chesscake', data: '1g'}
  // { left: 'vanilla', right: 'blackforest', data: '2.5g'}
  </code></pre>
  
  <p>since my bidimap is implemented with Maps of Maps, it is supposed to be time-constant. I want to proove it by benchmarking it.</p>
  
  <p>I wish to use benchmark.js to measure it.</p>
  
  <pre><code>let sizes = [10, 20, 50, 100, 200, 500, 1000, 2000, 5000]
  let density = [1, 2, 5, 10, 20, 50, 100] // percentages
  
  sizes.forEach((s) =&gt; {
    density.forEach((d) =&gt; {
        // START TIMER
        // generatte a S items list (left)
        // generatte a S items list (rightt)
       // store list in map
       // association items left * right with a robability of 1 / D
       // END TIMER
  
       // REPORT (LOG) size * density --&gt; time
    })
  })
  </code></pre>
  
  <p>How to write proper tests with the lib benchmarks.js ?</p>
  
  <p>AND:</p>
  
  <p>How to evaluate memory footprint  of the data structuere ?</p>
  
  <p>Thanks in advance !</p>