Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
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:
one year ago
Test name
Executions per second
WeakMap get
34076600.0 Ops/sec
Symbol with WeakMap fallback get
410830208.0 Ops/sec
WeakMap set
21078680.0 Ops/sec
Symbol with WeakMap fallback set
351542528.0 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);