Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
WeakMap vs "Symbol with WeakMap fallback"
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0
Browser:
Firefox 127
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
Symbol with WeakMap fallback get
410.8M/s
Symbol with WeakMap fallback set
351.5M/s
WeakMap get
34.1M/s
WeakMap set
21.1M/s
View exact numbers
Test name
Executions per second
✓
Symbol with WeakMap fallback get
410,830,208 Ops/sec
Symbol with WeakMap fallback set
351,542,528 Ops/sec
WeakMap get
34,076,600 Ops/sec
WeakMap set
21,078,680 Ops/sec
Script Preparation code:
var c = Symbol === undefined ? (function() { var x = function() { this._x = new WeakMap(); } x.prototype.get = function(x) { return this._x.get(x); }; x.prototype.set = function(x,y) { this._x.set(x,y); }; return x; })() : (function() { var x = function() { this._x = Symbol(); } x.prototype.get = function(x) { return x[this._x]; }; x.prototype.set = function(x,y) { x[this._x] = y; }; return x; })(); var to0 = {}; var to1 = {}; var wm = new WeakMap(); var fwm = new c(); wm.set(to1, 1); fwm.set(to1, 1);
Tests:
WeakMap get
let r = wm.get(to1);
Symbol with WeakMap fallback get
let r = fwm.get(to1);
WeakMap set
wm.set(to0, 1);
Symbol with WeakMap fallback set
fwm.set(to0, 1);