Message from JavaScript discussions

May 2017

— That would have to be added to accessor functions

— 

Set add: 242.868ms
myset add: 3457.758ms
arrset add: 512.244ms
set has: 211.680ms
myset has: 246.181ms
arrset has: 451.055ms
set delete: 209.773ms
myset delete: 432.708ms
arrset delete: 396.808ms
set add: 215.026ms
myset add: 3004.371ms
arrset add: 488.098ms
set has: 216.353ms
myset has: 249.573ms
arrset has: 443.429ms
set delete: 210.459ms
myset delete: 419.375ms
arrset delete: 396.871ms

— Pretty consistently 400ms, while native is around 220

— Interesting...

— I would say it is twice as slow because you are looping twice as much

— In case I changed something

— I'm sure they optimize iterating arrays pretty well

— Hash consing etc... probably, but we can see this in the spec

— Tbh, averaging 2x native without hashmap is pretty good

— Map does this:
"Repeat for each Record {[[key]], [[value]]} p that is an element of entries,
If p.[[key]] is not empty and SameValueZero(p.[[key]], key) is true, return true.
Return false."

Message permanent page

— Uhm?

— Is that for has?