speci/readme.md

53 lines
684 B
Markdown
Raw Normal View History

2023-09-04 14:53:39 +00:00
# speci.js - specialization benchmark test
Tests two-property objects with {x, y} or {y, x} and access in a tight loop
When the array contains consistent elements it optimizes well, but the first
run is much slower on a randomly mixed array.
Subsequent runs come up much faster as the higher-tier compilers in V8 can
handle a couple of different variants -- but this might not be true of all
possibilities. 256 randomized variants is linearly slower.
```
% node speci.js
** x_first
run 1
72 ms
run 2
15 ms
run 3
22 ms
** y_first
run 1
73 ms
run 2
23 ms
run 3
20 ms
** mixed
run 1
2766 ms
run 2
52 ms
run 3
53 ms
** randomized
run 1
464 ms
run 2
445 ms
run 3
445 ms
```