-
-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Direct array element access on
ByValue
instructions (#2827)
Most of the time that we have a `ByValue` ( `[ value ]` syntax ) it is for arrays and the value is usually an index. This PR adds a fast path to the instructions (without calling `.borrow()` on the object to check if its an array) For example, this code: ```js let a = [1, 2, 3] for (let i = 0 ; i < 10000000; ++i) { a[i % 3] += a[ (i + 1) % 3 ] } ``` Using `hyperfine`, it ran `1.38` times faster on this PR. ```bash Benchmark 1: ./boa_main test.js Time (mean ± σ): 16.504 s ± 0.192 s [User: 16.440 s, System: 0.020 s] Range (min … max): 16.328 s … 16.938 s 10 runs Benchmark 2: ./boa_direct_array_access test.js Time (mean ± σ): 11.982 s ± 0.038 s [User: 11.939 s, System: 0.013 s] Range (min … max): 11.914 s … 12.035 s 10 runs Summary './boa_direct_array_access test.js' ran 1.38 ± 0.02 times faster than './boa_main test.js' ```
- Loading branch information
Showing
5 changed files
with
120 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters