HackerTrans
TopNewTrendsCommentsPastAskShowJobs

syg

no profile record

comments

syg
·vor 9 Monaten·discuss
This kind of elision is implemented.
syg
·letztes Jahr·discuss
Yeah this is the bug. My bad, will fix.
syg
·vor 2 Jahren·discuss
Only if your implementation holds doubles without boxing them. V8 boxes doubles, but JSC and SpiderMonkey do not.
syg
·vor 2 Jahren·discuss
Well I'm trying to make it suck less.
syg
·vor 2 Jahren·discuss
To be more precise, aligned to whatever size such that you can guarantee field writes that don't tear. Pointer-aligned is a safe bet. 4-byte aligned should be okay too on 64bit architectures if you use pointer compression like V8 does.

What kind of types did you have in mind? Machine integers and "any" (i.e., a JS primitive or object)?

And yes, in browsers this will be gated by cross-origin isolation.
syg
·vor 2 Jahren·discuss
The ability to do unordered operations on shared memory is important in general to write performant multithreaded code. On x86, which is very close to sequentially consistent by default (it has something called TSO, not SC), there is less of a delta. But the world seems to be moving towards architectures with weaker memory models, in particular ARM, where the performance difference between ordinary operations and sequentially consistent operations is much larger.

For example, if you're protecting the internal state of some data structure with a mutex, the mutex lock and unlock operations are what ensures ordering and visibility of your memory writes. In the critical section, you don't need to do atomic, sequentially consistent accesses. Doing so has no additional safety and only introduces performance overhead, which can be significant on certain architectures.
syg
·vor 2 Jahren·discuss
Author here. I hear your feedback about unsafe blocks. Similar sentiment is shared by other delegates of the JS standards committee.

The main reason it is there today is to satisfy some delegates' requirement that we build in guardrails so as to naturally discourage authors from creating thread-unsafe public APIs and libraries by default. We're exploring other ideas to try to satisfy that requirement without unsafe blocks.
syg
·vor 3 Jahren·discuss
Exactly right. `arr[-1]` means `arr["-1"]` and already does something.