1,569 karma · joined May 2, 2012
One of the things V8 does is store "field dependencies" -- a list of optimized code attached to fields that is invalidated if that field is modified in a certain way. The optimized code is known to only access that field in a certain way, thus doesn't need to check it, so this only slows down unoptimized paths (and only on their slow paths too, since even unoptimized code has fast paths for known access patterns thanks to inline caches). Comes with a memory/generality cost though, so this isn't used for every type of check.
> We have initially designated 9am to 3pm Pacific Time as “coordination hours” where most employees will be expected to be available for meetings and impromptu communication, regardless of where they are located. This maps to 6am to 12pm in Hawaii, 12pm to 6pm Eastern Time, 5pm to 11pm in the UK, and 6pm to 12am across most of Europe
I know that I wouldn't work for them from Europe if those were the conditions.
Changing this to a "structure of arrays" approach, with the x value inline in the array, reduces the runtime by another order of magnitude:
const arr_x = new Array(ROWS * COLS).fill(0);
function doSoA() {
for (let i = 0; i < ROWS; i++) {
for (let j = 0; j < COLS; j++) {
arr_x[i * ROWS + j] = 0;
}
}
}
Started data Local
Finished data locality test run in 0.6168 seconds
Started data Non Local
Finished data locality test run in 2.6442 seconds
Started data Non Local Sorted
Finished data locality test run in 0.7923 seconds
Started data structure-of-arrays
Finished data locality test run in 0.0627 seconds
This is a microbenchmark, so that this with a grain of salt of course. /"([^"\\]|\\.)*"/
Now double that up with a single quote version if you wish.What you can't match without backreferences, however, is strings with customisable terminators, e.g. the behaviour in sed that whatever character you use after `s` is the regex terminator (it doesn't have to be `/`), or raw strings in C++.
I stand by "sort out", or even just "sort" as a good translation for załatwić, especially in British English, where I would use "sorted" as a single word sentence similar to "załatwione". There's other possible translations too, I could e.g. imagine using "score" when it's specifically about obtaining something physical, or "get it done" if it's about expediency or perseverance; if anything there's too many ways of translating it!
I keep meaning to look into SIMD for both this and ordinary tokenisation, last time I tried it the bookkeeping overheads and alignment requirements weren't worth the speedup but it's always worth re-evaluating.
[0] https://v8.dev/docs/torque [1] https://cs.chromium.org/chromium/src/v8/src/builtins/builtin... [2] https://cs.chromium.org/chromium/src/out/Debug/gen/v8/torque... [3] https://cs.chromium.org/chromium/src/v8/src/init/bootstrappe...
https://cs.chromium.org/chromium/src/v8/third_party/v8/built...
That's trivially impossible for fixed-size hashes, by the pigeon hole principle.