5 ms·
>"This object will only ever have these properties; it will never have properties created or deleted" >"This prototype will never be modified at runtime" You
by chmod775 6y ago
>"This object will only ever have these properties; it will never have properties created or deleted"
>"This prototype will never be modified at runtime"
You can already give these hints with Object.freeze/Object.seal
Not really hints though, they enforce a certain behavior. Because hints aren't enough. A JS engine may already assume you'll never change the objects, but it still has to support cases where you then do so anyways.
I don't think these alone would enable any substantial speedups, since the performance issues arise where unknown objects are used.
- eyelidlessness 6y ago> You can already give these hints with Object.freeze/Object.seal You can but my understanding is the performance tradeoffs aren't great unless you have a workload that especially benefits from it. Those calls are expensive.