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.
|
|
|
|
|
|
|
|
```
|
2023-09-04 17:23:59 +00:00
|
|
|
% make test
|
|
|
|
node speci.js x-first
|
|
|
|
** x-first
|
2023-09-04 14:53:39 +00:00
|
|
|
run 1
|
2023-09-04 17:23:59 +00:00
|
|
|
189 ms
|
2023-09-04 14:53:39 +00:00
|
|
|
|
|
|
|
run 2
|
2023-09-04 17:23:59 +00:00
|
|
|
293 ms
|
2023-09-04 14:53:39 +00:00
|
|
|
|
|
|
|
run 3
|
2023-09-04 17:23:59 +00:00
|
|
|
178 ms
|
2023-09-04 14:53:39 +00:00
|
|
|
|
2023-09-04 17:23:59 +00:00
|
|
|
node speci.js y-first
|
|
|
|
** y-first
|
2023-09-04 14:53:39 +00:00
|
|
|
run 1
|
2023-09-04 17:23:59 +00:00
|
|
|
196 ms
|
2023-09-04 14:53:39 +00:00
|
|
|
|
|
|
|
run 2
|
2023-09-04 17:23:59 +00:00
|
|
|
175 ms
|
2023-09-04 14:53:39 +00:00
|
|
|
|
|
|
|
run 3
|
2023-09-04 17:23:59 +00:00
|
|
|
174 ms
|
2023-09-04 14:53:39 +00:00
|
|
|
|
2023-09-04 17:23:59 +00:00
|
|
|
node speci.js mixed
|
2023-09-04 14:53:39 +00:00
|
|
|
** mixed
|
|
|
|
run 1
|
2023-09-04 17:23:59 +00:00
|
|
|
732 ms
|
2023-09-04 14:53:39 +00:00
|
|
|
|
|
|
|
run 2
|
2023-09-04 17:23:59 +00:00
|
|
|
716 ms
|
2023-09-04 14:53:39 +00:00
|
|
|
|
|
|
|
run 3
|
2023-09-04 17:23:59 +00:00
|
|
|
912 ms
|
2023-09-04 14:53:39 +00:00
|
|
|
|
2023-09-04 17:23:59 +00:00
|
|
|
node speci.js rand-suffix
|
|
|
|
** rand-suffix
|
2023-09-04 14:53:39 +00:00
|
|
|
run 1
|
2023-09-04 17:23:59 +00:00
|
|
|
15596 ms
|
2023-09-04 14:53:39 +00:00
|
|
|
|
|
|
|
run 2
|
2023-09-04 17:23:59 +00:00
|
|
|
15636 ms
|
2023-09-04 14:53:39 +00:00
|
|
|
|
|
|
|
run 3
|
2023-09-04 17:23:59 +00:00
|
|
|
15501 ms
|
|
|
|
|
|
|
|
node speci.js rand-prefix
|
|
|
|
** rand-prefix
|
|
|
|
run 1
|
|
|
|
18896 ms
|
|
|
|
|
|
|
|
run 2
|
|
|
|
18883 ms
|
|
|
|
|
|
|
|
run 3
|
|
|
|
18784 ms
|
2023-09-04 14:53:39 +00:00
|
|
|
```
|