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.js | changed |
benchmark/index.js | added |
index.js | ||
---|---|---|
@@ -50,9 +50,11 @@ | ||
50 | 50 … | /** |
51 | 51 … | * clears the referance map of a objects |
52 | 52 … | */ |
53 | 53 … | clear () { |
54 | - this.intRefProp = Symbol('int') | |
54 … | + this._map.forEach(el => { | |
55 … | + delete el[this.intRefProp] | |
56 … | + }) | |
55 | 57 … | this._map = [] |
56 | 58 … | } |
57 | 59 … | |
58 | 60 … | /** |
benchmark/index.js | ||
---|---|---|
@@ -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