git ssb

0+

wanderer🌟 / referenceMap



Commit a94ec20101a9c7f926111a3b9f2896121dd46c4f

better object tracking

Signed-off-by: wanderer <mjbecze@gmail.com>
wanderer committed on 4/2/2018, 10:47:59 PM
Parent: ba6e5ca1aaa05936404892d2ef715732f5b0e785

Files changed

index.jschanged
benchmark/index.jsadded
index.jsView
@@ -50,9 +50,11 @@
5050 /**
5151 * clears the referance map of a objects
5252 */
5353 clear () {
54- this.intRefProp = Symbol('int')
54 + this._map.forEach(el => {
55 + delete el[this.intRefProp]
56 + })
5557 this._map = []
5658 }
5759
5860 /**
benchmark/index.jsView
@@ -1,0 +1,15 @@
1 +const Rmap = require('../')
2 +
3 +function main () {
4 + let start = new Date()
5 + const map = new Rmap()
6 + let num = 1000000
7 + while (--num) {
8 + map.add({})
9 + }
10 +
11 + const end = new Date() - start
12 + console.info('Execution time: %dms', end)
13 +}
14 +
15 +main()

Built with git-ssb-web