Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Feature arrays with empty elements #1870

Closed
wants to merge 1 commit into from

Conversation

HalidOdat
Copy link
Member

@HalidOdat HalidOdat commented Feb 26, 2022

This PR adds support for arrays with empty elements e.g. ["", false, , , ]. Before we were filling the empty places with undefined, but this is wrong according to spec there shouldn't be undefined with a index at that place, instead only length is incremented. So [,,,].length == 3 and operations like [,,,,].indexOf(undefined) == -1, [,,,,].lastIndexOf(undefined) == -1 etc.

@HalidOdat HalidOdat added enhancement New feature or request execution Issues or PRs related to code execution vm Issues and PRs related to the Boa Virtual Machine. labels Feb 26, 2022
@github-actions
Copy link

github-actions bot commented Feb 26, 2022

Test262 conformance changes

VM implementation

Test result main count PR count difference
Total 88,342 88,342 0
Passed 42,779 42,919 +140
Ignored 21,413 21,413 0
Failed 24,150 24,010 -140
Panics 12 12 0
Conformance 48.42% 48.58% +0.16%
Fixed tests (140):
test/built-ins/Array/prototype/indexOf/15.4.4.14-9-b-i-15.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/indexOf/15.4.4.14-9-b-i-15.js (previously Failed)
test/built-ins/Array/prototype/indexOf/15.4.4.14-9-b-i-7.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/indexOf/15.4.4.14-9-b-i-7.js (previously Failed)
test/built-ins/Array/prototype/indexOf/15.4.4.14-9-a-10.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/indexOf/15.4.4.14-9-a-10.js (previously Failed)
test/built-ins/Array/prototype/indexOf/15.4.4.14-9-b-1.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/indexOf/15.4.4.14-9-b-1.js (previously Failed)
test/built-ins/Array/prototype/reduce/15.4.4.21-9-b-7.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/reduce/15.4.4.21-9-b-7.js (previously Failed)
test/built-ins/Array/prototype/reduce/15.4.4.21-9-b-20.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/reduce/15.4.4.21-9-b-20.js (previously Failed)
test/built-ins/Array/prototype/reduce/15.4.4.21-9-b-24.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/reduce/15.4.4.21-9-b-24.js (previously Failed)
test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-8.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-8.js (previously Failed)
test/built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-8.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-8.js (previously Failed)
test/built-ins/Array/prototype/reduce/15.4.4.21-9-b-11.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/reduce/15.4.4.21-9-b-11.js (previously Failed)
test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-16.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/reduce/15.4.4.21-8-b-iii-1-16.js (previously Failed)
test/built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-16.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/reduce/15.4.4.21-9-c-i-16.js (previously Failed)
test/built-ins/Array/prototype/copyWithin/fill-holes.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/copyWithin/fill-holes.js (previously Failed)
test/built-ins/Array/prototype/forEach/15.4.4.18-7-c-i-8.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/forEach/15.4.4.18-7-c-i-8.js (previously Failed)
test/built-ins/Array/prototype/forEach/15.4.4.18-7-b-11.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/forEach/15.4.4.18-7-b-11.js (previously Failed)
test/built-ins/Array/prototype/forEach/15.4.4.18-7-c-i-16.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/forEach/15.4.4.18-7-c-i-16.js (previously Failed)
test/built-ins/Array/prototype/forEach/15.4.4.18-7-b-7.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/forEach/15.4.4.18-7-b-7.js (previously Failed)
test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-24.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-24.js (previously Failed)
test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-7.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-7.js (previously Failed)
test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-11.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-11.js (previously Failed)
test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-8.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-8.js (previously Failed)
test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-16.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-16.js (previously Failed)
test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-8.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-8.js (previously Failed)
test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-20.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-20.js (previously Failed)
test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-16.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-16.js (previously Failed)
test/built-ins/Array/prototype/every/15.4.4.16-7-c-i-16.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/every/15.4.4.16-7-c-i-16.js (previously Failed)
test/built-ins/Array/prototype/every/15.4.4.16-7-c-i-8.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/every/15.4.4.16-7-c-i-8.js (previously Failed)
test/built-ins/Array/prototype/every/15.4.4.16-7-b-11.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/every/15.4.4.16-7-b-11.js (previously Failed)
test/built-ins/Array/prototype/every/15.4.4.16-7-b-7.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/every/15.4.4.16-7-b-7.js (previously Failed)
test/built-ins/Array/prototype/filter/15.4.4.20-9-b-7.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/filter/15.4.4.20-9-b-7.js (previously Failed)
test/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-16.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-16.js (previously Failed)
test/built-ins/Array/prototype/filter/15.4.4.20-9-b-11.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/filter/15.4.4.20-9-b-11.js (previously Failed)
test/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-8.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/filter/15.4.4.20-9-c-i-8.js (previously Failed)
test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-a-10.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-a-10.js (previously Failed)
test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-b-1.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-b-1.js (previously Failed)
test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-b-i-15.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-b-i-15.js (previously Failed)
test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-b-i-7.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-8-b-i-7.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-getter-deletes-predecessor.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-getter-deletes-predecessor.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-comparefn-throws.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-comparefn-throws.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-prototype-element.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-prototype-element.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-setter-increases-length.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-setter-increases-length.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-getter-decreases-length.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-getter-decreases-length.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-getter-deletes-successor.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-getter-deletes-successor.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-getter-appends-elements.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-getter-appends-elements.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-setter-pops-elements.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-setter-pops-elements.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-getter-increases-length.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-getter-increases-length.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-prototype-accessors.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-prototype-accessors.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-setter-deletes-predecessor.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-setter-deletes-predecessor.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-setter-appends-elements.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-setter-appends-elements.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-setter-decreases-length.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-setter-decreases-length.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-setter-sets-successor.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-setter-sets-successor.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-setter-deletes-successor.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-setter-deletes-successor.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-getter-sets-predecessor.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-getter-sets-predecessor.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-getter-sets-successor.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-getter-sets-successor.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-setter-sets-predecessor.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-setter-sets-predecessor.js (previously Failed)
test/built-ins/Array/prototype/sort/bug_596_2.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/bug_596_2.js (previously Failed)
test/built-ins/Array/prototype/sort/precise-getter-pops-elements.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/sort/precise-getter-pops-elements.js (previously Failed)
test/built-ins/Array/prototype/map/15.4.4.19-8-b-7.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/map/15.4.4.19-8-b-7.js (previously Failed)
test/built-ins/Array/prototype/map/15.4.4.19-8-b-11.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/map/15.4.4.19-8-b-11.js (previously Failed)
test/built-ins/Array/prototype/map/15.4.4.19-8-c-i-16.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/map/15.4.4.19-8-c-i-16.js (previously Failed)
test/built-ins/Array/prototype/map/15.4.4.19-8-c-i-8.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/map/15.4.4.19-8-c-i-8.js (previously Failed)
test/built-ins/Array/prototype/some/15.4.4.17-7-c-i-16.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/some/15.4.4.17-7-c-i-16.js (previously Failed)
test/built-ins/Array/prototype/some/15.4.4.17-7-c-i-8.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/some/15.4.4.17-7-c-i-8.js (previously Failed)
test/built-ins/Array/prototype/some/15.4.4.17-7-b-7.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/some/15.4.4.17-7-b-7.js (previously Failed)
test/built-ins/Array/prototype/some/15.4.4.17-7-b-11.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/some/15.4.4.17-7-b-11.js (previously Failed)
test/built-ins/Object/defineProperty/15.2.3.6-4-160.js [strict mode] (previously Failed)
test/built-ins/Object/defineProperty/15.2.3.6-4-160.js (previously Failed)
test/built-ins/Object/defineProperty/15.2.3.6-4-159.js [strict mode] (previously Failed)
test/built-ins/Object/defineProperty/15.2.3.6-4-159.js (previously Failed)
test/built-ins/Object/keys/15.2.3.14-5-13.js [strict mode] (previously Failed)
test/built-ins/Object/keys/15.2.3.14-5-13.js (previously Failed)
test/built-ins/Object/defineProperties/15.2.3.7-6-a-156.js [strict mode] (previously Failed)
test/built-ins/Object/defineProperties/15.2.3.7-6-a-156.js (previously Failed)
test/built-ins/Object/defineProperties/15.2.3.7-6-a-155.js [strict mode] (previously Failed)
test/built-ins/Object/defineProperties/15.2.3.7-6-a-155.js (previously Failed)

@github-actions
Copy link

Benchmark for d17ec3c

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 420.4±1.05ns 465.6±1.21ns +10.75%
Arithmetic operations (Execution) 1689.8±1.55ns 2.3±0.20µs +36.11%
Arithmetic operations (Parser) 4.5±0.03µs 5.2±0.01µs +15.56%
Array access (Compiler) 1042.9±2.57ns 1099.4±9.30ns +5.42%
Array access (Execution) 9.0±0.03µs 9.2±0.02µs +2.22%
Array access (Parser) 10.2±0.04µs 10.3±0.04µs +0.98%
Array creation (Compiler) 1583.7±4.84ns 1567.7±3.76ns -1.01%
Array creation (Execution) 3.1±0.01ms 2.8±0.00ms -9.68%
Array creation (Parser) 11.4±0.06µs 11.7±0.05µs +2.63%
Array pop (Compiler) 3.3±0.00µs 3.3±0.01µs 0.00%
Array pop (Execution) 1374.5±3.78µs 1482.2±56.87µs +7.84%
Array pop (Parser) 113.8±0.09µs 113.4±0.09µs -0.35%
Boolean Object Access (Compiler) 933.3±1.72ns 933.9±1.96ns +0.06%
Boolean Object Access (Execution) 5.0±0.01µs 5.2±0.01µs +4.00%
Boolean Object Access (Parser) 12.5±0.03µs 12.6±0.02µs +0.80%
Clean js (Compiler) 3.0±0.01µs 3.3±0.01µs +10.00%
Clean js (Execution) 951.7±3.46µs 1005.7±5.06µs +5.67%
Clean js (Parser) 24.8±0.02µs 25.2±0.02µs +1.61%
Create Realm 253.9±24.08ns 237.0±0.36ns -6.66%
Dynamic Object Property Access (Compiler) 1560.5±3.48ns 1396.8±25.86ns -10.49%
Dynamic Object Property Access (Execution) 5.8±0.02µs 6.0±0.03µs +3.45%
Dynamic Object Property Access (Parser) 9.2±0.03µs 10.5±0.02µs +14.13%
Fibonacci (Compiler) 1925.4±12.44ns 1958.0±8.49ns +1.69%
Fibonacci (Execution) 1533.8±4.46µs 1836.3±5.78µs +19.72%
Fibonacci (Parser) 15.6±0.05µs 14.1±0.07µs -9.62%
For loop (Compiler) 1672.6±3.82ns 1700.2±5.13ns +1.65%
For loop (Execution) 42.5±0.22µs 39.0±0.15µs -8.24%
For loop (Parser) 11.8±0.06µs 12.1±0.08µs +2.54%
Mini js (Compiler) 3.2±0.02µs 2.8±0.02µs -12.50%
Mini js (Execution) 872.9±3.67µs 1049.6±24.21µs +20.24%
Mini js (Parser) 21.7±0.02µs 24.8±0.03µs +14.29%
Number Object Access (Compiler) 868.9±4.75ns 875.4±2.39ns +0.75%
Number Object Access (Execution) 3.9±0.01µs 4.2±0.02µs +7.69%
Number Object Access (Parser) 9.6±0.02µs 11.1±0.03µs +15.63%
Object Creation (Compiler) 1153.1±4.69ns 1213.2±9.88ns +5.21%
Object Creation (Execution) 5.2±0.02µs 5.4±0.01µs +3.85%
Object Creation (Parser) 8.0±0.05µs 8.1±0.04µs +1.25%
RegExp (Compiler) 1360.2±5.70ns 1376.6±7.11ns +1.21%
RegExp (Execution) 10.8±0.04µs 12.1±0.07µs +12.04%
RegExp (Parser) 8.8±0.04µs 8.8±0.03µs 0.00%
RegExp Creation (Compiler) 1347.6±6.16ns 1184.3±4.72ns -12.12%
RegExp Creation (Execution) 8.2±0.02µs 7.9±0.03µs -3.66%
RegExp Creation (Parser) 7.3±0.03µs 7.4±0.02µs +1.37%
RegExp Literal (Compiler) 1362.9±4.85ns 1382.3±6.09ns +1.42%
RegExp Literal (Execution) 10.8±0.04µs 12.3±0.06µs +13.89%
RegExp Literal (Parser) 7.0±0.01µs 7.1±0.07µs +1.43%
RegExp Literal Creation (Compiler) 1322.0±2.00ns 1221.4±3.81ns -7.61%
RegExp Literal Creation (Execution) 8.2±0.02µs 7.9±0.02µs -3.66%
RegExp Literal Creation (Parser) 6.3±0.02µs 5.6±0.02µs -11.11%
Static Object Property Access (Compiler) 1320.2±2.02ns 1202.1±9.42ns -8.95%
Static Object Property Access (Execution) 5.4±0.02µs 5.6±0.02µs +3.70%
Static Object Property Access (Parser) 8.6±0.04µs 8.7±0.02µs +1.16%
String Object Access (Compiler) 1245.9±2.91ns 1253.6±3.63ns +0.62%
String Object Access (Execution) 6.4±0.01µs 7.1±0.29µs +10.94%
String Object Access (Parser) 12.2±0.01µs 12.3±0.02µs +0.82%
String comparison (Compiler) 1755.6±6.34ns 1988.7±95.80ns +13.28%
String comparison (Execution) 5.1±0.02µs 5.2±0.01µs +1.96%
String comparison (Parser) 9.4±0.07µs 11.0±0.07µs +17.02%
String concatenation (Compiler) 1370.9±5.09ns 1391.9±5.42ns +1.53%
String concatenation (Execution) 4.5±0.01µs 4.8±0.03µs +6.67%
String concatenation (Parser) 6.5±0.03µs 6.7±0.03µs +3.08%
String copy (Compiler) 1068.8±4.57ns 1086.5±2.69ns +1.66%
String copy (Execution) 4.1±0.01µs 4.2±0.01µs +2.44%
String copy (Parser) 4.8±0.02µs 5.6±0.02µs +16.67%
Symbols (Compiler) 736.3±1.01ns 747.0±2.01ns +1.45%
Symbols (Execution) 4.4±0.02µs 4.9±0.34µs +11.36%
Symbols (Parser) 4.3±0.02µs 4.3±0.04µs 0.00%

@raskad
Copy link
Member

raskad commented Feb 26, 2022

I would switch the naming from Hole to Elision to be aligned with the spec.

@HalidOdat HalidOdat force-pushed the feature/array-with-empty-elements branch 3 times, most recently from ce41659 to f136b6c Compare February 26, 2022 20:11
@HalidOdat HalidOdat marked this pull request as ready for review February 26, 2022 20:12
@codecov
Copy link

codecov bot commented Feb 26, 2022

Codecov Report

Merging #1870 (ac95fc3) into main (60e2294) will decrease coverage by 0.01%.
The diff coverage is 45.45%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1870      +/-   ##
==========================================
- Coverage   46.67%   46.65%   -0.02%     
==========================================
  Files         204      204              
  Lines       16701    16706       +5     
==========================================
- Hits         7796     7795       -1     
- Misses       8905     8911       +6     
Impacted Files Coverage Δ
boa_engine/src/vm/code_block.rs 46.69% <ø> (ø)
boa_engine/src/vm/mod.rs 70.71% <0.00%> (-0.56%) ⬇️
boa_engine/src/vm/opcode.rs 42.85% <ø> (ø)
boa_engine/src/bytecompiler.rs 38.80% <33.33%> (+0.06%) ⬆️
...parser/expression/primary/array_initializer/mod.rs 52.17% <100.00%> (ø)
boa_engine/src/value/display.rs 80.00% <100.00%> (-0.44%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 60e2294...ac95fc3. Read the comment docs.

@github-actions
Copy link

Benchmark for b67ce04

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 425.8±1.21ns 466.2±1.11ns +9.49%
Arithmetic operations (Execution) 1680.0±11.68ns 1870.7±2.81ns +11.35%
Arithmetic operations (Parser) 4.6±0.02µs 4.5±0.01µs -2.17%
Array access (Compiler) 1212.3±3.83ns 1052.8±2.42ns -13.16%
Array access (Execution) 9.6±0.14µs 9.9±0.03µs +3.13%
Array access (Parser) 10.3±0.02µs 10.1±0.02µs -1.94%
Array creation (Compiler) 1563.4±3.26ns 1555.2±28.43ns -0.52%
Array creation (Execution) 3.1±0.00ms 2.9±0.00ms -6.45%
Array creation (Parser) 13.3±0.04µs 11.4±0.02µs -14.29%
Array pop (Compiler) 3.4±0.01µs 3.4±0.01µs 0.00%
Array pop (Execution) 1372.9±2.95µs 1240.6±3.00µs -9.64%
Array pop (Parser) 114.4±0.39µs 114.9±0.28µs +0.44%
Boolean Object Access (Compiler) 972.7±8.14ns 935.0±2.07ns -3.88%
Boolean Object Access (Execution) 5.0±0.03µs 5.3±0.02µs +6.00%
Boolean Object Access (Parser) 12.5±0.01µs 12.3±0.36µs -1.60%
Clean js (Compiler) 2.9±0.00µs 3.4±0.02µs +17.24%
Clean js (Execution) 955.9±4.55µs 1011.0±7.23µs +5.76%
Clean js (Parser) 25.2±0.03µs 24.8±0.04µs -1.59%
Create Realm 238.3±2.36ns 228.8±0.26ns -3.99%
Dynamic Object Property Access (Compiler) 1358.4±5.47ns 1340.0±4.48ns -1.35%
Dynamic Object Property Access (Execution) 5.8±0.02µs 6.0±0.03µs +3.45%
Dynamic Object Property Access (Parser) 9.2±0.02µs 9.0±0.02µs -2.17%
Fibonacci (Compiler) 1979.7±5.32ns 1912.3±6.02ns -3.40%
Fibonacci (Execution) 1710.9±4.10µs 1602.6±6.67µs -6.33%
Fibonacci (Parser) 14.0±0.03µs 13.7±0.02µs -2.14%
For loop (Compiler) 1652.8±4.47ns 1650.6±4.79ns -0.13%
For loop (Execution) 41.3±0.15µs 39.1±0.14µs -5.33%
For loop (Parser) 12.0±0.04µs 11.8±0.02µs -1.67%
Mini js (Compiler) 2.8±0.01µs 2.8±0.01µs 0.00%
Mini js (Execution) 875.5±3.94µs 929.7±3.07µs +6.19%
Mini js (Parser) 24.9±0.03µs 21.7±0.04µs -12.85%
Number Object Access (Compiler) 884.9±2.01ns 869.3±2.43ns -1.76%
Number Object Access (Execution) 3.9±0.01µs 4.1±0.01µs +5.13%
Number Object Access (Parser) 11.0±0.07µs 9.5±0.02µs -13.64%
Object Creation (Compiler) 1195.2±3.22ns 1139.5±2.02ns -4.66%
Object Creation (Execution) 5.9±0.01µs 5.4±0.01µs -8.47%
Object Creation (Parser) 8.1±0.03µs 7.9±0.01µs -2.47%
RegExp (Compiler) 1537.9±2.32ns 1347.4±6.19ns -12.39%
RegExp (Execution) 10.6±0.08µs 12.7±0.07µs +19.81%
RegExp (Parser) 10.1±0.02µs 8.6±0.04µs -14.85%
RegExp Creation (Compiler) 1213.8±4.16ns 1150.8±2.11ns -5.19%
RegExp Creation (Execution) 7.8±0.01µs 9.5±0.02µs +21.79%
RegExp Creation (Parser) 7.4±0.03µs 7.2±0.01µs -2.70%
RegExp Literal (Compiler) 1368.4±3.72ns 1352.7±4.57ns -1.15%
RegExp Literal (Execution) 10.4±0.03µs 12.5±0.07µs +20.19%
RegExp Literal (Parser) 7.2±0.02µs 7.0±0.01µs -2.78%
RegExp Literal Creation (Compiler) 1177.7±3.16ns 1164.8±2.85ns -1.10%
RegExp Literal Creation (Execution) 7.8±0.01µs 8.4±0.03µs +7.69%
RegExp Literal Creation (Parser) 5.6±0.02µs 5.5±0.01µs -1.79%
Static Object Property Access (Compiler) 1167.7±2.82ns 1169.0±2.82ns +0.11%
Static Object Property Access (Execution) 6.1±0.02µs 5.6±0.01µs -8.20%
Static Object Property Access (Parser) 8.7±0.02µs 8.4±0.01µs -3.45%
String Object Access (Compiler) 1258.2±2.69ns 1411.7±10.83ns +12.20%
String Object Access (Execution) 6.5±0.02µs 6.9±0.03µs +6.15%
String Object Access (Parser) 12.3±0.03µs 12.0±0.12µs -2.44%
String comparison (Compiler) 1752.5±4.16ns 1782.1±5.11ns +1.69%
String comparison (Execution) 5.7±0.01µs 5.2±0.03µs -8.77%
String comparison (Parser) 9.7±0.02µs 9.4±0.02µs -3.09%
String concatenation (Compiler) 1372.4±3.02ns 1368.1±2.87ns -0.31%
String concatenation (Execution) 4.5±0.01µs 4.8±0.05µs +6.67%
String concatenation (Parser) 7.5±0.02µs 6.5±0.01µs -13.33%
String copy (Compiler) 1098.5±2.38ns 1073.9±2.80ns -2.24%
String copy (Execution) 4.6±0.01µs 4.2±0.02µs -8.70%
String copy (Parser) 5.0±0.03µs 4.8±0.01µs -4.00%
Symbols (Compiler) 756.3±1.30ns 727.8±0.86ns -3.77%
Symbols (Execution) 4.4±0.01µs 4.0±0.01µs -9.09%
Symbols (Parser) 3.8±0.02µs 3.7±0.01µs -2.63%

@HalidOdat HalidOdat force-pushed the feature/array-with-empty-elements branch from f136b6c to ac95fc3 Compare February 27, 2022 14:00
@github-actions
Copy link

Benchmark for f4c6996

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 592.7±21.76ns 605.7±9.90ns +2.19%
Arithmetic operations (Execution) 2.2±0.08µs 2.3±0.08µs +4.55%
Arithmetic operations (Parser) 5.4±0.23µs 5.7±0.07µs +5.56%
Array access (Compiler) 1417.2±45.70ns 1488.6±35.76ns +5.04%
Array access (Execution) 10.8±0.35µs 11.4±0.17µs +5.56%
Array access (Parser) 12.0±0.51µs 13.2±0.62µs +10.00%
Array creation (Compiler) 1998.7±80.35ns 2.1±0.05µs +5.07%
Array creation (Execution) 3.7±0.06ms 3.6±0.11ms -2.70%
Array creation (Parser) 13.9±0.34µs 14.1±0.20µs +1.44%
Array pop (Compiler) 4.3±0.08µs 4.4±0.09µs +2.33%
Array pop (Execution) 1595.4±54.98µs 1621.7±39.64µs +1.65%
Array pop (Parser) 141.6±4.23µs 151.2±8.52µs +6.78%
Boolean Object Access (Compiler) 1187.8±24.78ns 1195.8±9.65ns +0.67%
Boolean Object Access (Execution) 6.8±0.09µs 6.6±0.25µs -2.94%
Boolean Object Access (Parser) 14.3±0.67µs 15.7±0.06µs +9.79%
Clean js (Compiler) 3.7±0.15µs 3.8±0.08µs +2.70%
Clean js (Execution) 1206.9±36.18µs 1251.5±42.71µs +3.70%
Clean js (Parser) 30.2±0.51µs 30.6±0.42µs +1.32%
Create Realm 309.3±10.31ns 311.3±9.37ns +0.65%
Dynamic Object Property Access (Compiler) 1781.1±56.11ns 1852.1±33.31ns +3.99%
Dynamic Object Property Access (Execution) 7.7±0.18µs 7.9±0.14µs +2.60%
Dynamic Object Property Access (Parser) 10.6±0.27µs 10.5±0.30µs -0.94%
Fibonacci (Compiler) 2.6±0.04µs 2.6±0.07µs 0.00%
Fibonacci (Execution) 1923.4±56.11µs 2.1±0.02ms +9.18%
Fibonacci (Parser) 16.7±0.49µs 16.9±0.23µs +1.20%
For loop (Compiler) 2.2±0.05µs 2.2±0.03µs 0.00%
For loop (Execution) 48.2±1.27µs 50.3±0.59µs +4.36%
For loop (Parser) 14.5±0.38µs 14.3±0.44µs -1.38%
Mini js (Compiler) 3.7±0.06µs 3.7±0.06µs 0.00%
Mini js (Execution) 1159.3±23.25µs 1187.4±32.08µs +2.42%
Mini js (Parser) 26.5±0.45µs 26.6±0.29µs +0.38%
Number Object Access (Compiler) 1100.6±16.54ns 1135.0±60.92ns +3.13%
Number Object Access (Execution) 5.0±0.20µs 5.1±0.22µs +2.00%
Number Object Access (Parser) 11.3±0.35µs 11.9±0.03µs +5.31%
Object Creation (Compiler) 1590.4±43.95ns 1603.2±19.47ns +0.80%
Object Creation (Execution) 7.4±0.38µs 7.0±0.19µs -5.41%
Object Creation (Parser) 9.3±0.26µs 9.6±0.18µs +3.23%
RegExp (Compiler) 1836.6±69.04ns 1904.4±21.71ns +3.69%
RegExp (Execution) 14.2±0.14µs 13.9±0.20µs -2.11%
RegExp (Parser) 10.0±0.33µs 10.3±0.28µs +3.00%
RegExp Creation (Compiler) 1668.5±19.01ns 1613.3±29.50ns -3.31%
RegExp Creation (Execution) 10.4±0.19µs 10.1±0.31µs -2.88%
RegExp Creation (Parser) 8.6±0.25µs 8.9±0.12µs +3.49%
RegExp Literal (Compiler) 1893.4±35.15ns 1917.2±16.50ns +1.26%
RegExp Literal (Execution) 14.1±0.13µs 13.5±0.44µs -4.26%
RegExp Literal (Parser) 8.1±0.27µs 8.5±0.21µs +4.94%
RegExp Literal Creation (Compiler) 1592.4±51.31ns 1592.3±30.75ns -0.01%
RegExp Literal Creation (Execution) 10.1±0.33µs 10.3±0.30µs +1.98%
RegExp Literal Creation (Parser) 6.7±0.08µs 6.4±0.28µs -4.48%
Static Object Property Access (Compiler) 1617.5±62.55ns 1620.8±14.58ns +0.20%
Static Object Property Access (Execution) 7.4±0.12µs 7.2±0.24µs -2.70%
Static Object Property Access (Parser) 10.1±0.27µs 10.1±0.29µs 0.00%
String Object Access (Compiler) 1575.5±110.32ns 1593.4±17.21ns +1.14%
String Object Access (Execution) 8.7±0.22µs 8.9±0.11µs +2.30%
String Object Access (Parser) 14.0±0.54µs 15.1±0.24µs +7.86%
String comparison (Compiler) 2.5±0.04µs 2.5±0.09µs 0.00%
String comparison (Execution) 6.5±0.24µs 6.8±0.18µs +4.62%
String comparison (Parser) 11.8±0.18µs 12.0±1.02µs +1.69%
String concatenation (Compiler) 1964.1±198.10ns 2.0±0.14µs +1.83%
String concatenation (Execution) 6.0±0.12µs 6.1±0.21µs +1.67%
String concatenation (Parser) 7.9±0.15µs 7.8±0.14µs -1.27%
String copy (Compiler) 1490.8±46.98ns 1470.2±39.02ns -1.38%
String copy (Execution) 5.5±0.12µs 5.4±0.17µs -1.82%
String copy (Parser) 5.8±0.10µs 5.8±0.15µs 0.00%
Symbols (Compiler) 1017.8±35.71ns 1091.4±19.51ns +7.23%
Symbols (Execution) 5.1±0.15µs 5.3±0.05µs +3.92%
Symbols (Parser) 4.3±0.08µs 4.4±0.09µs +2.33%

Copy link
Member

@Razican Razican left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good! thanks! :)

@Razican Razican added this to the v0.14.0 milestone Feb 27, 2022
@Razican
Copy link
Member

Razican commented Feb 27, 2022

bors r+

bors bot pushed a commit that referenced this pull request Feb 27, 2022
This PR adds support for arrays with empty elements e.g. `["", false, , , ]`. Before we were filling the empty places with `undefined`, but this is wrong according to [spec](https://tc39.es/ecma262/#sec-runtime-semantics-arrayaccumulation) there shouldn't be undefined with a index at that place, instead only `length` is incremented. So `[,,,].length == 3` and operations like `[,,,,].indexOf(undefined) == -1`,  `[,,,,].lastIndexOf(undefined) == -1` etc.
@bors
Copy link

bors bot commented Feb 27, 2022

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Feature arrays with empty elements [Merged by Bors] - Feature arrays with empty elements Feb 27, 2022
@bors bors bot closed this Feb 27, 2022
@bors bors bot deleted the feature/array-with-empty-elements branch February 27, 2022 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request execution Issues or PRs related to code execution vm Issues and PRs related to the Boa Virtual Machine.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants