Script Preparation code:
x
 
var objects = [];
var symbols = [];
var symbolObj = {__proto__: null};
var symbolMap = new Map();
var symbolSet = new Set();
var objectMap = new Map();
var objectSet = new Set();
var emptyObj = {__proto__: null};
var emptyMap = new Map();
var emptySet = new Set();
for (let i = 0; i < 1000; i++) {
  objects[i] = {i, sym: Symbol(i)};
  symbols[i] = objects[i].sym;
  symbolObj[symbols[i]] = i;
  symbolSet.add(symbols[i]);
  symbolMap.set(symbols[i], i);
  objectSet.add(objects[i]);
  objectMap.set(objects[i], i);
}
function objRead(obj, keys) {
  let total = 0;
  for (const key of keys) {
    total += obj[key];
  }
  return total;
}
function objWrite(obj, keys) {
  for (const key of keys) {
    obj[key] = true;
  }
}
function mapRead(map, keys) {
  let total = 0;
  for (const key of keys) {
    total += map.get(key);
  }
  return total;
}
function mapWrite(map, keys) {
  for (const key of keys) {
    map.set(key, true);
  }
}
function setRead(set, keys) {
  let total = 0;
  for (const key of keys) {
    total += set.has(key) ? 1 : 0;
  }
  return total;
}
function setWrite(set, keys) {
  for (const key of keys) {
    set.add(key);
  }
}
Tests:
  • Symbol read: Object

     
    objRead(symbolObj, symbols)
  • Symbol read: Set

     
    setRead(symbolSet, symbols)
  • Symbol read: Map

     
    mapRead(symbolMap, symbols)
  • Object read: Set

     
    setRead(objectSet, objects)
  • Object read: Map

     
    mapRead(objectMap, objects)
  • Symbol write: Object

     
    objWrite(symbolObj, symbols)
  • Symbol write: Set

     
    setWrite(symbolSet, symbols)
  • Symbol write: Map

     
    mapWrite(symbolMap, symbols);
  • Object write: Set

     
    setWrite(objectSet, objects);
  • Object write: Map

     
    mapWrite(objectMap, objects);
  • Symbol insert: Object

     
    objWrite(emptyObj, symbols);
  • Symbol insert: Set

     
    setWrite(emptySet, symbols);
  • Symbol insert: Map

     
    mapWrite(emptyMap, symbols);
  • Object insert: Set

     
    setWrite(emptySet, objects);
  • Object insert: Map

     
    mapWrite(emptyMap, objects);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Symbol read: Object
    Symbol read: Set
    Symbol read: Map
    Object read: Set
    Object read: Map
    Symbol write: Object
    Symbol write: Set
    Symbol write: Map
    Object write: Set
    Object write: Map
    Symbol insert: Object
    Symbol insert: Set
    Symbol insert: Map
    Object insert: Set
    Object insert: Map

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 10 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0
Firefox 123 on Windows
View result in a separate tab
Test name Executions per second
Symbol read: Object 74141.2 Ops/sec
Symbol read: Set 142846.6 Ops/sec
Symbol read: Map 134411.3 Ops/sec
Object read: Set 96863.8 Ops/sec
Object read: Map 95626.0 Ops/sec
Symbol write: Object 68587.5 Ops/sec
Symbol write: Set 64844.8 Ops/sec
Symbol write: Map 52930.6 Ops/sec
Object write: Set 49480.9 Ops/sec
Object write: Map 43045.1 Ops/sec
Symbol insert: Object 54931.5 Ops/sec
Symbol insert: Set 64928.5 Ops/sec
Symbol insert: Map 55977.2 Ops/sec
Object insert: Set 52553.2 Ops/sec
Object insert: Map 44808.8 Ops/sec