Script Preparation code:
AخA
 
var to0 = {};
var to1 = {};
var wm = new WeakMap();
var sy = Symbol();
wm.set(to1, 1);
to1[sy] = 1;
window.r = 0
Tests:
  • WeakMap set

     
    wm.set(to0, 1);
  • Symbol Property set

     
    to0[sy] = 1;
  • WeakMap get

     
    r = wm.get(to1);
  • Symbol Property get

     
    r = to1[sy];
  • Symbol Property get (from own descriptor)

     
    r = Object.getOwnPropertyDescriptor(to1, sy).value;
  • Symbol Property get (if hasOwn)

     
    r = Object.hasOwn(to1, sy) ? to1[sy] : undefined;
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    WeakMap set
    Symbol Property set
    WeakMap get
    Symbol Property get
    Symbol Property get (from own descriptor)
    Symbol Property get (if hasOwn)

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 6 months ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36 Edg/129.0.0.0
Chrome 129 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
WeakMap set 14126756.0 Ops/sec
Symbol Property set 14978403.0 Ops/sec
WeakMap get 7216884.5 Ops/sec
Symbol Property get 7425304.5 Ops/sec
Symbol Property get (from own descriptor) 4879848.0 Ops/sec
Symbol Property get (if hasOwn) 3861038.2 Ops/sec