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] - Added boa examples #1161

Closed
wants to merge 9 commits into from
Closed

[Merged by Bors] - Added boa examples #1161

wants to merge 9 commits into from

Conversation

jasonwilliams
Copy link
Member

Added boa examples as per issue #446
Overtaken #634

Somehow screwed that branch up by rebasing it and losing access
pings @elasmojs

This Pull Request fixes/closes #446 .

Copy link
Member

@RageKnify RageKnify left a comment

Choose a reason for hiding this comment

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

Some minor things in the Cargo.toml files.

Cargo.toml Outdated Show resolved Hide resolved
examples/Cargo.toml Outdated Show resolved Hide resolved
Copy link
Member

@RageKnify RageKnify left a comment

Choose a reason for hiding this comment

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

1 typo and a change to make the Rust code more idiomatic.

examples/src/loadfile.rs Outdated Show resolved Hide resolved
examples/src/modulehandler.rs Outdated Show resolved Hide resolved
Cargo.toml Show resolved Hide resolved
@Razican
Copy link
Member

Razican commented May 10, 2021

Hello @jasonwilliams how is this going?

@jasonwilliams
Copy link
Member Author

OK, from what i remember it was just the change @RageKnify pointed out.
Will try to get back on this this week

@Razican
Copy link
Member

Razican commented May 22, 2021

I have updated the most simple examples, but the rest require some extra work.

@Razican Razican added the documentation update documentation label May 22, 2021
@Razican Razican modified the milestones: v0.12.0, v0.13.0 May 22, 2021
@github-actions
Copy link

github-actions bot commented May 22, 2021

Test262 conformance changes

VM implementation

Test result main count PR count difference
Total 88,410 88,410 0
Passed 43,784 43,784 0
Ignored 21,481 21,481 0
Failed 23,145 23,145 0
Panics 0 0 0
Conformance 49.52% 49.52% 0.00%

@github-actions
Copy link

Benchmark for 84abecc

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 360.7±4.62ns 365.2±10.38ns -1.23%
Arithmetic operations (Full) 268.8±4.59µs 266.4±4.80µs +0.90%
Array access (Execution) 6.0±0.22µs 6.0±0.21µs 0.00%
Array access (Full) 289.2±4.77µs 287.2±7.26µs +0.70%
Array creation (Execution) 2.6±0.07ms 2.6±0.06ms 0.00%
Array creation (Full) 3.1±0.05ms 3.1±0.05ms 0.00%
Array pop (Execution) 868.0±14.52µs 862.0±14.51µs +0.70%
Array pop (Full) 1373.6±28.10µs 1385.0±29.88µs -0.82%
Boolean Object Access (Execution) 5.1±0.11µs 5.2±0.28µs -1.92%
Boolean Object Access (Full) 289.0±10.29µs 284.4±4.57µs +1.62%
Clean js (Execution) 647.8±11.11µs 680.7±32.09µs -4.83%
Clean js (Full) 967.2±16.77µs 968.9±17.09µs -0.18%
Clean js (Parser) 40.6±0.41µs 39.4±0.78µs +3.05%
Create Realm 456.2±34.68ns 423.2±10.89ns +7.80%
Dynamic Object Property Access (Execution) 4.9±0.11µs 5.1±0.31µs -3.92%
Dynamic Object Property Access (Full) 292.2±16.21µs 285.4±7.41µs +2.38%
Expression (Parser) 7.4±0.28µs 7.1±0.17µs +4.23%
Fibonacci (Execution) 726.2±13.87µs 719.7±17.47µs +0.90%
Fibonacci (Full) 1097.2±51.55µs 1052.2±16.95µs +4.28%
For loop (Execution) 21.8±1.51µs 22.4±1.27µs -2.68%
For loop (Full) 299.5±6.75µs 300.3±5.62µs -0.27%
For loop (Parser) 19.1±0.40µs 19.0±0.34µs +0.53%
Goal Symbols (Parser) 13.9±0.31µs 13.7±0.40µs +1.46%
Hello World (Parser) 4.1±0.22µs 3.9±0.09µs +5.13%
Long file (Parser) 784.3±34.68ns 780.9±10.73ns +0.44%
Mini js (Execution) 574.5±11.51µs 574.1±11.84µs +0.07%
Mini js (Full) 904.3±12.88µs 885.9±27.36µs +2.08%
Mini js (Parser) 36.5±2.06µs 34.6±0.60µs +5.49%
Number Object Access (Execution) 3.9±0.08µs 4.1±0.17µs -4.88%
Number Object Access (Full) 272.8±7.30µs 275.1±5.71µs -0.84%
Object Creation (Execution) 4.1±0.08µs 4.1±0.13µs 0.00%
Object Creation (Full) 281.1±5.27µs 274.9±7.60µs +2.26%
RegExp (Execution) 11.3±0.35µs 10.8±0.21µs +4.63%
RegExp (Full) 291.0±6.27µs 293.4±7.15µs -0.82%
RegExp Literal (Execution) 10.7±0.21µs 10.9±0.12µs -1.83%
RegExp Literal (Full) 290.3±7.09µs 294.8±6.17µs -1.53%
RegExp Literal Creation (Execution) 9.8±0.39µs 10.0±0.48µs -2.00%
RegExp Literal Creation (Full) 293.7±3.60µs 288.4±4.89µs +1.84%
Static Object Property Access (Execution) 4.3±0.11µs 4.6±0.03µs -6.52%
Static Object Property Access (Full) 287.4±7.07µs 278.9±6.33µs +3.05%
String Object Access (Execution) 7.1±0.11µs 7.1±0.17µs 0.00%
String Object Access (Full) 295.7±2.72µs 283.5±6.75µs +4.30%
String comparison (Execution) 6.5±0.34µs 6.3±0.13µs +3.17%
String comparison (Full) 277.9±7.86µs 291.5±9.06µs -4.67%
String concatenation (Execution) 5.1±0.10µs 5.1±0.10µs 0.00%
String concatenation (Full) 280.5±5.57µs 283.0±3.03µs -0.88%
String copy (Execution) 3.9±0.25µs 3.8±0.10µs +2.63%
String copy (Full) 276.2±5.61µs 272.0±7.41µs +1.54%
Symbols (Execution) 3.4±0.04µs 3.3±0.05µs +3.03%
Symbols (Full) 270.6±5.82µs 277.2±15.62µs -2.38%

@github-actions
Copy link

Benchmark for 6cfef13

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 378.1±16.77ns 374.3±13.81ns +1.02%
Arithmetic operations (Full) 289.8±12.64µs 306.0±12.67µs -5.29%
Array access (Execution) 7.2±0.30µs 7.2±0.23µs 0.00%
Array access (Full) 339.1±19.56µs 327.0±22.58µs +3.70%
Array creation (Execution) 2.7±0.13ms 2.8±0.08ms -3.57%
Array creation (Full) 3.2±0.10ms 3.0±0.19ms +6.67%
Array pop (Execution) 915.4±35.68µs 916.8±28.34µs -0.15%
Array pop (Full) 1464.5±96.88µs 1383.8±60.22µs +5.83%
Boolean Object Access (Execution) 5.6±0.28µs 5.8±0.23µs -3.45%
Boolean Object Access (Full) 307.0±13.72µs 329.4±31.75µs -6.80%
Clean js (Execution) 697.6±27.62µs 705.4±34.36µs -1.11%
Clean js (Full) 986.5±47.74µs 1071.1±119.29µs -7.90%
Clean js (Parser) 41.6±2.52µs 42.9±2.28µs -3.03%
Create Realm 440.1±18.32ns 438.7±19.35ns +0.32%
Dynamic Object Property Access (Execution) 5.6±0.20µs 6.0±0.22µs -6.67%
Dynamic Object Property Access (Full) 335.3±19.87µs 327.1±11.39µs +2.51%
Expression (Parser) 7.5±0.29µs 7.1±0.40µs +5.63%
Fibonacci (Execution) 927.6±26.81µs 912.4±40.18µs +1.67%
Fibonacci (Full) 1259.4±52.00µs 1213.0±75.84µs +3.83%
For loop (Execution) 25.2±1.73µs 24.8±0.74µs +1.61%
For loop (Full) 347.4±16.18µs 334.4±16.15µs +3.89%
For loop (Parser) 19.8±1.10µs 19.8±1.14µs 0.00%
Goal Symbols (Parser) 13.8±0.90µs 14.2±0.83µs -2.82%
Hello World (Parser) 4.3±0.27µs 4.0±0.19µs +7.50%
Long file (Parser) 774.1±36.04ns 774.7±50.33ns -0.08%
Mini js (Execution) 633.6±28.42µs 602.3±25.61µs +5.20%
Mini js (Full) 926.5±48.54µs 950.1±47.92µs -2.48%
Mini js (Parser) 37.3±1.68µs 37.6±2.41µs -0.80%
Number Object Access (Execution) 4.4±0.31µs 4.6±0.15µs -4.35%
Number Object Access (Full) 302.3±13.53µs 320.8±13.80µs -5.77%
Object Creation (Execution) 5.2±0.15µs 5.1±0.16µs +1.96%
Object Creation (Full) 327.5±6.68µs 326.7±18.34µs +0.24%
RegExp (Execution) 11.4±0.49µs 12.5±0.71µs -8.80%
RegExp (Full) 336.0±11.55µs 341.8±15.92µs -1.70%
RegExp Literal (Execution) 11.6±0.50µs 12.4±0.51µs -6.45%
RegExp Literal (Full) 345.2±39.76µs 337.0±11.13µs +2.43%
RegExp Literal Creation (Execution) 10.1±0.48µs 10.8±0.46µs -6.48%
RegExp Literal Creation (Full) 333.4±17.44µs 324.5±9.59µs +2.74%
Static Object Property Access (Execution) 5.3±0.19µs 5.4±0.12µs -1.85%
Static Object Property Access (Full) 327.9±11.19µs 312.1±11.30µs +5.06%
String Object Access (Execution) 7.9±0.32µs 8.0±0.40µs -1.25%
String Object Access (Full) 314.1±14.08µs 331.9±12.14µs -5.36%
String comparison (Execution) 7.0±0.34µs 7.1±0.31µs -1.41%
String comparison (Full) 315.9±24.08µs 338.5±15.56µs -6.68%
String concatenation (Execution) 5.7±0.30µs 5.9±0.19µs -3.39%
String concatenation (Full) 305.6±18.67µs 332.9±10.49µs -8.20%
String copy (Execution) 4.3±0.24µs 4.4±0.21µs -2.27%
String copy (Full) 304.2±10.93µs 316.5±11.15µs -3.89%
Symbols (Execution) 3.9±0.15µs 3.9±0.19µs 0.00%
Symbols (Full) 307.4±9.59µs 294.6±12.30µs +4.34%

@raskad raskad modified the milestones: v0.13.0, v0.14.0 Sep 25, 2021
boa_examples/src/main.rs Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Nov 2, 2021

Codecov Report

Merging #1161 (806c1eb) into main (fb8c5cf) will decrease coverage by 0.00%.
The diff coverage is n/a.

❗ Current head 806c1eb differs from pull request most recent head 9535f99. Consider uploading reports for the commit 9535f99 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1161      +/-   ##
==========================================
- Coverage   46.59%   46.58%   -0.01%     
==========================================
  Files         205      206       +1     
  Lines       16753    16781      +28     
==========================================
+ Hits         7806     7818      +12     
- Misses       8947     8963      +16     
Impacted Files Coverage Δ
boa_engine/src/builtins/global_this/mod.rs 50.00% <0.00%> (-50.00%) ⬇️
boa_engine/src/builtins/generator_function/mod.rs 76.19% <0.00%> (-4.77%) ⬇️
boa_engine/src/builtins/symbol/mod.rs 58.33% <0.00%> (-0.83%) ⬇️
boa_engine/src/builtins/mod.rs 11.47% <0.00%> (-0.20%) ⬇️
boa_engine/src/builtins/error/mod.rs 90.00% <0.00%> (ø)
boa_engine/src/builtins/error/aggregate.rs 42.10% <0.00%> (ø)
boa_engine/src/context.rs 46.08% <0.00%> (+0.18%) ⬆️
boa_engine/src/builtins/number/mod.rs 76.31% <0.00%> (+0.36%) ⬆️

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 fb8c5cf...9535f99. Read the comment docs.

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 good to me, I think these examples will be useful for our users. The only thing I'm missing is a small description on the top of each example with module level comments (//!) explaining what the example is supposed to do.

Also, I would say we don't have an example that changes the global object, right? Do we want to have this? Is it possible with the current API?

@jasonwilliams
Copy link
Member Author

Looks good to me, I think these examples will be useful for our users. The only thing I'm missing is a small description on the top of each example with module level comments (//!) explaining what the example is supposed to do.

Also, I would say we don't have an example that changes the global object, right? Do we want to have this? Is it possible with the current API?

How do you mean change the global object? Do you mean to add properties to it?

@Razican
Copy link
Member

Razican commented Dec 7, 2021

How do you mean change the global object? Do you mean to add properties to it?

I meant using "window" as a global object for example, but I guess that's just an alias, right? And then adding some attributes to it.

@Razican
Copy link
Member

Razican commented Feb 5, 2022

@jasonwilliams do you think we could have this ready for 0.14? It would be nice to have new examples here.

@github-actions
Copy link

github-actions bot commented Feb 7, 2022

Benchmark for 7a68787

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 552.8±22.21ns 541.2±26.68ns -2.10%
Arithmetic operations (Execution) 2.5±0.11µs 2.5±0.07µs 0.00%
Arithmetic operations (Parser) 7.5±0.25µs 7.7±0.50µs +2.67%
Array access (Compiler) 1156.4±113.14ns 1124.7±52.12ns -2.74%
Array access (Execution) 14.0±0.57µs 13.9±0.70µs -0.71%
Array access (Parser) 16.3±0.86µs 16.0±0.70µs -1.84%
Array creation (Compiler) 1557.1±77.31ns 1612.1±73.41ns +3.53%
Array creation (Execution) 3.9±0.18ms 3.9±0.18ms 0.00%
Array creation (Parser) 17.3±0.84µs 17.7±0.84µs +2.31%
Array pop (Compiler) 3.7±0.18µs 3.8±0.17µs +2.70%
Array pop (Execution) 1699.1±88.77µs 1638.7±102.10µs -3.55%
Array pop (Parser) 191.0±9.59µs 197.3±12.71µs +3.30%
Boolean Object Access (Compiler) 957.8±51.50ns 964.3±80.15ns +0.68%
Boolean Object Access (Execution) 8.9±0.55µs 9.1±0.49µs +2.25%
Boolean Object Access (Parser) 18.5±0.76µs 18.6±1.39µs +0.54%
Clean js (Compiler) 3.1±0.16µs 3.1±0.48µs 0.00%
Clean js (Execution) 1840.1±96.34µs 1855.2±77.93µs +0.82%
Clean js (Parser) 36.9±2.05µs 37.5±2.27µs +1.63%
Create Realm 421.9±21.83ns 442.9±32.26ns +4.98%
Dynamic Object Property Access (Compiler) 1639.8±93.34ns 1593.8±72.87ns -2.81%
Dynamic Object Property Access (Execution) 9.3±0.37µs 9.1±0.62µs -2.15%
Dynamic Object Property Access (Parser) 14.0±0.55µs 14.3±1.38µs +2.14%
Fibonacci (Compiler) 2.1±0.13µs 2.1±0.08µs 0.00%
Fibonacci (Execution) 3.9±0.20ms 4.0±0.15ms +2.56%
Fibonacci (Parser) 21.1±1.72µs 21.4±0.89µs +1.42%
For loop (Compiler) 1777.9±123.61ns 1743.7±110.03ns -1.92%
For loop (Execution) 57.8±3.28µs 56.6±2.38µs -2.08%
For loop (Parser) 18.1±0.96µs 18.3±0.81µs +1.10%
Mini js (Compiler) 3.1±0.17µs 3.0±0.29µs -3.23%
Mini js (Execution) 1714.8±65.88µs 1742.3±75.76µs +1.60%
Mini js (Parser) 32.0±1.53µs 33.6±1.86µs +5.00%
Number Object Access (Compiler) 907.5±45.72ns 883.9±43.53ns -2.60%
Number Object Access (Execution) 6.8±0.25µs 7.1±0.38µs +4.41%
Number Object Access (Parser) 14.7±0.92µs 14.7±0.85µs 0.00%
Object Creation (Compiler) 1326.3±84.98ns 1344.0±159.41ns +1.33%
Object Creation (Execution) 8.6±0.39µs 8.6±0.42µs 0.00%
Object Creation (Parser) 12.1±0.71µs 12.1±0.82µs 0.00%
RegExp (Compiler) 1601.9±55.73ns 1571.9±69.58ns -1.87%
RegExp (Execution) 16.9±0.78µs 16.5±0.86µs -2.37%
RegExp (Parser) 13.6±1.00µs 13.3±0.79µs -2.21%
RegExp Creation (Compiler) 1448.9±64.61ns 1394.6±72.65ns -3.75%
RegExp Creation (Execution) 12.7±0.51µs 12.5±0.73µs -1.57%
RegExp Creation (Parser) 11.0±0.69µs 11.1±0.46µs +0.91%
RegExp Literal (Compiler) 1627.8±132.54ns 1582.8±73.12ns -2.76%
RegExp Literal (Execution) 16.7±0.70µs 16.7±0.89µs 0.00%
RegExp Literal (Parser) 10.6±0.61µs 10.8±0.54µs +1.89%
RegExp Literal Creation (Compiler) 1429.5±61.93ns 1395.2±66.78ns -2.40%
RegExp Literal Creation (Execution) 12.5±0.64µs 12.5±0.63µs 0.00%
RegExp Literal Creation (Parser) 8.4±0.95µs 8.5±0.43µs +1.19%
Static Object Property Access (Compiler) 1369.3±91.41ns 1353.2±62.71ns -1.18%
Static Object Property Access (Execution) 8.7±0.51µs 8.7±0.55µs 0.00%
Static Object Property Access (Parser) 13.1±0.52µs 12.8±0.79µs -2.29%
String Object Access (Compiler) 1430.3±70.09ns 1392.7±77.97ns -2.63%
String Object Access (Execution) 11.1±0.44µs 11.4±0.72µs +2.70%
String Object Access (Parser) 18.3±0.68µs 18.8±0.93µs +2.73%
String comparison (Compiler) 1746.2±75.60ns 1762.1±85.91ns +0.91%
String comparison (Execution) 9.6±0.44µs 9.5±0.53µs -1.04%
String comparison (Parser) 14.7±0.64µs 14.8±1.13µs +0.68%
String concatenation (Compiler) 1487.1±98.31ns 1432.1±79.22ns -3.70%
String concatenation (Execution) 8.1±0.46µs 8.3±0.41µs +2.47%
String concatenation (Parser) 9.9±0.49µs 10.2±0.41µs +3.03%
String copy (Compiler) 1221.1±37.18ns 1199.5±55.06ns -1.77%
String copy (Execution) 7.1±0.31µs 7.1±0.39µs 0.00%
String copy (Parser) 7.6±0.76µs 7.4±0.48µs -2.63%
Symbols (Compiler) 915.7±44.20ns 949.5±39.32ns +3.69%
Symbols (Execution) 6.9±0.38µs 6.7±0.35µs -2.90%
Symbols (Parser) 5.6±0.33µs 5.7±0.44µs +1.79%

@Razican
Copy link
Member

Razican commented Feb 14, 2022

I will look at this during the week, I would love to merge it asap :)

@github-actions
Copy link

Benchmark for be7b626

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 388.9±0.91ns 389.0±1.03ns +0.03%
Arithmetic operations (Execution) 1991.0±15.02ns 1988.1±15.42ns -0.15%
Arithmetic operations (Parser) 5.5±0.01µs 5.5±0.01µs 0.00%
Array access (Compiler) 815.4±1.84ns 812.9±1.34ns -0.31%
Array access (Execution) 10.5±0.05µs 10.6±0.06µs +0.95%
Array access (Parser) 12.1±0.02µs 12.2±0.03µs +0.83%
Array creation (Compiler) 1179.6±3.68ns 1164.1±3.50ns -1.31%
Array creation (Execution) 3.1±0.00ms 3.1±0.01ms 0.00%
Array creation (Parser) 13.6±0.02µs 13.5±0.04µs -0.74%
Array pop (Compiler) 2.8±0.01µs 2.8±0.00µs 0.00%
Array pop (Execution) 1351.1±4.50µs 1347.3±20.37µs -0.28%
Array pop (Parser) 136.0±0.16µs 141.2±0.09µs +3.82%
Boolean Object Access (Compiler) 702.7±2.32ns 692.5±0.99ns -1.45%
Boolean Object Access (Execution) 6.9±0.02µs 6.9±0.02µs 0.00%
Boolean Object Access (Parser) 14.2±0.02µs 14.2±0.01µs 0.00%
Clean js (Compiler) 2.2±0.00µs 2.2±0.00µs 0.00%
Clean js (Execution) 1467.1±12.71µs 1459.8±12.90µs -0.50%
Clean js (Parser) 29.2±0.03µs 28.8±0.07µs -1.37%
Create Realm 333.4±0.31ns 334.9±2.35ns +0.45%
Dynamic Object Property Access (Compiler) 1174.3±3.66ns 1158.7±4.16ns -1.33%
Dynamic Object Property Access (Execution) 6.8±0.09µs 6.8±0.04µs 0.00%
Dynamic Object Property Access (Parser) 11.0±0.02µs 10.9±0.02µs -0.91%
Fibonacci (Compiler) 1471.1±3.40ns 1446.5±6.48ns -1.67%
Fibonacci (Execution) 2.7±0.02ms 2.7±0.00ms 0.00%
Fibonacci (Parser) 16.4±0.02µs 16.0±0.02µs -2.44%
For loop (Compiler) 1292.3±3.88ns 1263.7±4.35ns -2.21%
For loop (Execution) 43.7±0.19µs 43.7±0.16µs 0.00%
For loop (Parser) 14.1±0.03µs 13.9±0.02µs -1.42%
Mini js (Compiler) 2.1±0.01µs 2.1±0.01µs 0.00%
Mini js (Execution) 1359.9±7.43µs 1353.9±12.35µs -0.44%
Mini js (Parser) 25.6±0.03µs 25.3±0.03µs -1.17%
Number Object Access (Compiler) 641.6±1.41ns 644.5±1.64ns +0.45%
Number Object Access (Execution) 5.3±0.02µs 5.4±0.02µs +1.89%
Number Object Access (Parser) 11.2±0.01µs 11.1±0.01µs -0.89%
Object Creation (Compiler) 950.3±2.09ns 961.0±1.82ns +1.13%
Object Creation (Execution) 6.2±0.03µs 6.2±0.02µs 0.00%
Object Creation (Parser) 9.6±0.02µs 9.4±0.02µs -2.08%
RegExp (Compiler) 1149.1±5.88ns 1141.2±2.69ns -0.69%
RegExp (Execution) 13.0±0.03µs 12.9±0.04µs -0.77%
RegExp (Parser) 10.4±0.01µs 10.4±0.01µs 0.00%
RegExp Creation (Compiler) 1027.6±3.71ns 1019.2±2.38ns -0.82%
RegExp Creation (Execution) 9.9±0.09µs 9.9±0.05µs 0.00%
RegExp Creation (Parser) 8.6±0.02µs 8.6±0.01µs 0.00%
RegExp Literal (Compiler) 1153.4±3.14ns 1163.7±6.16ns +0.89%
RegExp Literal (Execution) 12.9±0.04µs 12.9±0.02µs 0.00%
RegExp Literal (Parser) 8.3±0.07µs 8.3±0.01µs 0.00%
RegExp Literal Creation (Compiler) 1049.6±3.38ns 1035.2±2.99ns -1.37%
RegExp Literal Creation (Execution) 9.9±0.05µs 9.8±0.07µs -1.01%
RegExp Literal Creation (Parser) 6.6±0.02µs 6.5±0.02µs -1.52%
Static Object Property Access (Compiler) 964.5±2.85ns 972.8±4.57ns +0.86%
Static Object Property Access (Execution) 6.3±0.03µs 6.4±0.03µs +1.59%
Static Object Property Access (Parser) 10.2±0.02µs 10.1±0.02µs -0.98%
String Object Access (Compiler) 1027.7±5.70ns 1046.2±4.34ns +1.80%
String Object Access (Execution) 8.6±0.02µs 8.6±0.02µs 0.00%
String Object Access (Parser) 14.0±0.01µs 13.9±0.02µs -0.71%
String comparison (Compiler) 1290.3±2.77ns 1286.6±3.82ns -0.29%
String comparison (Execution) 7.1±0.03µs 7.1±0.03µs 0.00%
String comparison (Parser) 11.1±0.02µs 10.9±0.08µs -1.80%
String concatenation (Compiler) 1051.6±3.39ns 1040.1±2.91ns -1.09%
String concatenation (Execution) 6.1±0.02µs 6.1±0.01µs 0.00%
String concatenation (Parser) 7.7±0.02µs 7.5±0.04µs -2.60%
String copy (Compiler) 865.1±3.36ns 873.1±3.77ns +0.92%
String copy (Execution) 5.2±0.02µs 5.3±0.02µs +1.92%
String copy (Parser) 5.7±0.02µs 5.6±0.02µs -1.75%
Symbols (Compiler) 636.5±1.08ns 644.2±1.49ns +1.21%
Symbols (Execution) 4.8±0.02µs 4.9±0.02µs +2.08%
Symbols (Parser) 4.4±0.01µs 4.3±0.03µs -2.27%

@github-actions
Copy link

github-actions bot commented Mar 3, 2022

Benchmark for dab5b4c

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 515.1±1.70ns 515.1±0.93ns 0.00%
Arithmetic operations (Execution) 1947.4±1.71ns 1962.7±49.55ns +0.79%
Arithmetic operations (Parser) 5.2±0.01µs 5.2±0.01µs 0.00%
Array access (Compiler) 1254.2±2.76ns 1235.4±3.35ns -1.50%
Array access (Execution) 9.7±0.05µs 9.9±0.05µs +2.06%
Array access (Parser) 11.5±0.01µs 11.5±0.01µs 0.00%
Array creation (Compiler) 1825.3±3.26ns 1821.0±5.10ns -0.24%
Array creation (Execution) 3.2±0.00ms 3.2±0.00ms 0.00%
Array creation (Parser) 12.9±0.01µs 13.0±0.02µs +0.78%
Array pop (Compiler) 3.9±0.01µs 3.9±0.01µs 0.00%
Array pop (Execution) 1401.3±2.74µs 1403.0±3.84µs +0.12%
Array pop (Parser) 129.8±0.18µs 129.8±0.07µs 0.00%
Boolean Object Access (Compiler) 1101.4±5.02ns 1101.6±2.86ns +0.02%
Boolean Object Access (Execution) 5.8±0.05µs 5.8±0.04µs 0.00%
Boolean Object Access (Parser) 14.2±0.01µs 14.3±0.01µs +0.70%
Clean js (Compiler) 3.4±0.01µs 3.4±0.02µs 0.00%
Clean js (Execution) 1102.6±10.75µs 1095.3±6.92µs -0.66%
Clean js (Parser) 28.2±0.03µs 28.2±0.06µs 0.00%
Create Realm 263.1±2.23ns 264.5±0.30ns +0.53%
Dynamic Object Property Access (Compiler) 1581.7±2.85ns 1576.9±3.33ns -0.30%
Dynamic Object Property Access (Execution) 6.8±0.03µs 6.8±0.03µs 0.00%
Dynamic Object Property Access (Parser) 10.2±0.02µs 10.3±0.02µs +0.98%
Fibonacci (Compiler) 2.2±0.01µs 2.2±0.01µs 0.00%
Fibonacci (Execution) 1756.6±2.54µs 1764.7±2.06µs +0.46%
Fibonacci (Parser) 15.8±0.02µs 15.8±0.26µs 0.00%
For loop (Compiler) 1939.5±9.29ns 1922.4±10.78ns -0.88%
For loop (Execution) 42.2±0.24µs 42.5±0.12µs +0.71%
For loop (Parser) 13.4±0.03µs 13.4±0.02µs 0.00%
Mini js (Compiler) 3.2±0.01µs 3.2±0.01µs 0.00%
Mini js (Execution) 1015.3±5.80µs 1008.5±5.23µs -0.67%
Mini js (Parser) 24.6±0.13µs 24.5±0.12µs -0.41%
Number Object Access (Compiler) 1028.7±4.81ns 1034.9±4.75ns +0.60%
Number Object Access (Execution) 4.5±0.02µs 4.5±0.03µs 0.00%
Number Object Access (Parser) 11.1±0.05µs 11.0±0.01µs -0.90%
Object Creation (Compiler) 1352.9±6.34ns 1348.7±3.32ns -0.31%
Object Creation (Execution) 6.0±0.02µs 6.1±0.02µs +1.67%
Object Creation (Parser) 8.9±0.01µs 8.9±0.02µs 0.00%
RegExp (Compiler) 1569.1±2.94ns 1578.6±2.29ns +0.61%
RegExp (Execution) 12.7±0.04µs 12.8±0.04µs +0.79%
RegExp (Parser) 9.8±0.03µs 9.9±0.02µs +1.02%
RegExp Creation (Compiler) 1385.6±5.87ns 1401.1±6.16ns +1.12%
RegExp Creation (Execution) 9.5±0.04µs 9.5±0.05µs 0.00%
RegExp Creation (Parser) 8.2±0.02µs 8.2±0.02µs 0.00%
RegExp Literal (Compiler) 1588.1±2.59ns 1599.2±2.02ns +0.70%
RegExp Literal (Execution) 12.6±0.05µs 12.7±0.03µs +0.79%
RegExp Literal (Parser) 8.0±0.02µs 8.0±0.02µs 0.00%
RegExp Literal Creation (Compiler) 1395.9±6.02ns 1363.5±6.25ns -2.32%
RegExp Literal Creation (Execution) 9.5±0.05µs 9.5±0.05µs 0.00%
RegExp Literal Creation (Parser) 6.3±0.05µs 6.3±0.02µs 0.00%
Static Object Property Access (Compiler) 1404.9±6.45ns 1379.8±5.54ns -1.79%
Static Object Property Access (Execution) 6.3±0.02µs 6.4±0.02µs +1.59%
Static Object Property Access (Parser) 9.6±0.01µs 9.7±0.02µs +1.04%
String Object Access (Compiler) 1440.2±7.57ns 1453.6±5.79ns +0.93%
String Object Access (Execution) 7.4±0.03µs 7.5±0.03µs +1.35%
String Object Access (Parser) 13.9±0.01µs 13.9±0.01µs 0.00%
String comparison (Compiler) 2.1±0.01µs 2.0±0.01µs -4.76%
String comparison (Execution) 5.8±0.01µs 5.8±0.02µs 0.00%
String comparison (Parser) 10.6±0.02µs 10.5±0.02µs -0.94%
String concatenation (Compiler) 1590.3±2.29ns 1618.2±4.70ns +1.75%
String concatenation (Execution) 5.3±0.01µs 5.3±0.02µs 0.00%
String concatenation (Parser) 7.3±0.01µs 7.3±0.02µs 0.00%
String copy (Compiler) 1271.3±2.55ns 1268.9±2.43ns -0.19%
String copy (Execution) 4.7±0.02µs 4.8±0.04µs +2.13%
String copy (Parser) 5.5±0.01µs 5.4±0.01µs -1.82%
Symbols (Compiler) 891.8±1.95ns 893.4±1.56ns +0.18%
Symbols (Execution) 4.4±0.01µs 4.5±0.02µs +2.27%
Symbols (Parser) 4.3±0.01µs 4.3±0.01µs 0.00%

@jasonwilliams
Copy link
Member Author

gc needed to be added as a dependency, not sure why when using boa_gc. Any ideas @Razican ?

@github-actions
Copy link

github-actions bot commented Mar 4, 2022

Benchmark for 109c2d7

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 452.4±1.58ns 512.0±1.73ns +13.17%
Arithmetic operations (Execution) 1972.2±6.80ns 1731.9±6.36ns -12.18%
Arithmetic operations (Parser) 4.6±0.00µs 5.2±0.01µs +13.04%
Array access (Compiler) 1124.8±2.15ns 1111.5±2.55ns -1.18%
Array access (Execution) 9.7±0.05µs 8.5±0.03µs -12.37%
Array access (Parser) 10.3±0.01µs 10.3±0.01µs 0.00%
Array creation (Compiler) 1822.3±2.93ns 1837.7±11.57ns +0.85%
Array creation (Execution) 2.6±0.00ms 2.6±0.01ms 0.00%
Array creation (Parser) 11.6±0.03µs 11.5±0.02µs -0.86%
Array pop (Compiler) 3.9±0.01µs 3.9±0.01µs 0.00%
Array pop (Execution) 1158.1±4.84µs 1306.5±6.34µs +12.81%
Array pop (Parser) 130.7±0.28µs 131.0±0.15µs +0.23%
Boolean Object Access (Compiler) 1097.7±3.28ns 976.8±2.34ns -11.01%
Boolean Object Access (Execution) 5.1±0.01µs 5.7±0.01µs +11.76%
Boolean Object Access (Parser) 12.6±0.03µs 12.7±0.04µs +0.79%
Clean js (Compiler) 3.4±0.01µs 3.4±0.01µs 0.00%
Clean js (Execution) 958.9±7.61µs 1078.0±6.22µs +12.42%
Clean js (Parser) 25.0±0.04µs 25.0±0.05µs 0.00%
Create Realm 276.5±0.46ns 276.8±0.90ns +0.11%
Dynamic Object Property Access (Compiler) 1436.2±21.59ns 1657.6±7.24ns +15.42%
Dynamic Object Property Access (Execution) 6.7±0.02µs 5.9±0.01µs -11.94%
Dynamic Object Property Access (Parser) 9.2±0.02µs 10.3±0.01µs +11.96%
Fibonacci (Compiler) 2.3±0.01µs 1979.0±4.69ns -13.96%
Fibonacci (Execution) 1528.6±5.07µs 1545.1±4.09µs +1.08%
Fibonacci (Parser) 14.0±0.01µs 15.9±0.06µs +13.57%
For loop (Compiler) 1934.4±5.82ns 1936.6±4.19ns +0.11%
For loop (Execution) 42.5±0.27µs 42.4±0.13µs -0.24%
For loop (Parser) 12.0±0.02µs 13.5±0.02µs +12.50%
Mini js (Compiler) 2.8±0.01µs 2.9±0.00µs +3.57%
Mini js (Execution) 996.2±15.49µs 993.0±6.04µs -0.32%
Mini js (Parser) 21.9±0.02µs 22.0±0.04µs +0.46%
Number Object Access (Compiler) 911.1±2.02ns 1026.1±10.87ns +12.62%
Number Object Access (Execution) 4.0±0.02µs 4.0±0.01µs 0.00%
Number Object Access (Parser) 11.1±0.03µs 9.9±0.03µs -10.81%
Object Creation (Compiler) 1246.7±5.69ns 1252.6±6.49ns +0.47%
Object Creation (Execution) 5.4±0.03µs 5.3±0.03µs -1.85%
Object Creation (Parser) 8.0±0.02µs 8.0±0.01µs 0.00%
RegExp (Compiler) 1485.4±13.64ns 1438.7±12.74ns -3.14%
RegExp (Execution) 12.2±0.06µs 10.6±0.05µs -13.11%
RegExp (Parser) 8.8±0.02µs 8.7±0.02µs -1.14%
RegExp Creation (Compiler) 1385.6±4.94ns 1246.1±1.96ns -10.07%
RegExp Creation (Execution) 8.0±0.03µs 8.9±0.03µs +11.25%
RegExp Creation (Parser) 7.3±0.02µs 7.3±0.01µs 0.00%
RegExp Literal (Compiler) 1480.3±12.88ns 1431.9±10.13ns -3.27%
RegExp Literal (Execution) 12.1±0.06µs 10.6±0.12µs -12.40%
RegExp Literal (Parser) 8.1±0.03µs 7.0±0.02µs -13.58%
RegExp Literal Creation (Compiler) 1398.5±5.46ns 1237.3±3.63ns -11.53%
RegExp Literal Creation (Execution) 9.0±0.04µs 8.9±0.03µs -1.11%
RegExp Literal Creation (Parser) 5.6±0.02µs 5.5±0.01µs -1.79%
Static Object Property Access (Compiler) 1281.5±10.28ns 1286.0±3.34ns +0.35%
Static Object Property Access (Execution) 6.3±0.02µs 6.3±0.03µs 0.00%
Static Object Property Access (Parser) 8.6±0.02µs 8.5±0.01µs -1.16%
String Object Access (Compiler) 1292.3±3.00ns 1477.2±5.34ns +14.31%
String Object Access (Execution) 6.6±0.04µs 7.5±0.02µs +13.64%
String Object Access (Parser) 12.3±0.02µs 12.3±0.02µs 0.00%
String comparison (Compiler) 1864.6±4.56ns 1848.6±7.63ns -0.86%
String comparison (Execution) 5.1±0.02µs 5.1±0.02µs 0.00%
String comparison (Parser) 10.8±0.02µs 9.4±0.01µs -12.96%
String concatenation (Compiler) 1436.4±5.20ns 1633.1±4.22ns +13.69%
String concatenation (Execution) 5.2±0.02µs 4.6±0.02µs -11.54%
String concatenation (Parser) 7.4±0.01µs 7.3±0.03µs -1.35%
String copy (Compiler) 1157.6±4.98ns 1145.7±6.58ns -1.03%
String copy (Execution) 4.2±0.02µs 4.7±0.02µs +11.90%
String copy (Parser) 5.5±0.01µs 4.9±0.03µs -10.91%
Symbols (Compiler) 900.5±3.80ns 798.4±1.05ns -11.34%
Symbols (Execution) 3.9±0.02µs 3.9±0.01µs 0.00%
Symbols (Parser) 3.8±0.01µs 4.2±0.01µs +10.53%

@Razican
Copy link
Member

Razican commented Mar 5, 2022

gc needed to be added as a dependency, not sure why when using boa_gc. Any ideas @Razican ?

This is due to the way deriving works for that crate. Maybe it can be fixed with a PR to the gc crate

@github-actions
Copy link

github-actions bot commented Mar 8, 2022

Benchmark for 13117eb

Click to view benchmark
Test Base PR %
Arithmetic operations (Compiler) 497.4±1.07ns 496.2±0.71ns -0.24%
Arithmetic operations (Execution) 1780.7±2.83ns 1771.7±2.46ns -0.51%
Arithmetic operations (Parser) 5.5±0.02µs 5.5±0.01µs 0.00%
Array access (Compiler) 1333.3±1.73ns 1319.5±2.48ns -1.04%
Array access (Execution) 10.2±0.04µs 10.2±0.04µs 0.00%
Array access (Parser) 12.3±0.03µs 12.5±0.48µs +1.63%
Array creation (Compiler) 1969.8±3.33ns 1966.9±3.38ns -0.15%
Array creation (Execution) 3.1±0.01ms 3.1±0.01ms 0.00%
Array creation (Parser) 13.9±0.04µs 13.9±0.02µs 0.00%
Array pop (Compiler) 3.8±0.01µs 3.8±0.01µs 0.00%
Array pop (Execution) 1370.3±12.08µs 1366.5±13.24µs -0.28%
Array pop (Parser) 144.0±11.28µs 140.2±0.13µs -2.64%
Boolean Object Access (Compiler) 1126.1±2.70ns 1123.8±4.11ns -0.20%
Boolean Object Access (Execution) 6.0±0.01µs 6.3±0.12µs +5.00%
Boolean Object Access (Parser) 14.3±0.02µs 14.3±0.02µs 0.00%
Clean js (Compiler) 3.6±0.01µs 3.7±0.01µs +2.78%
Clean js (Execution) 1086.6±15.25µs 1075.2±5.12µs -1.05%
Clean js (Parser) 29.7±0.11µs 29.8±0.08µs +0.34%
Create Realm 251.3±0.30ns 249.0±0.28ns -0.92%
Dynamic Object Property Access (Compiler) 1737.1±7.08ns 1764.7±5.26ns +1.59%
Dynamic Object Property Access (Execution) 6.7±0.09µs 7.0±0.04µs +4.48%
Dynamic Object Property Access (Parser) 10.9±0.05µs 10.9±0.03µs 0.00%
Fibonacci (Compiler) 2.4±0.01µs 2.4±0.01µs 0.00%
Fibonacci (Execution) 1831.9±8.39µs 1863.0±4.40µs +1.70%
Fibonacci (Parser) 16.7±0.06µs 16.7±0.16µs 0.00%
For loop (Compiler) 2.1±0.01µs 2.1±0.01µs 0.00%
For loop (Execution) 39.7±0.15µs 39.6±0.14µs -0.25%
For loop (Parser) 14.0±0.05µs 14.1±0.03µs +0.71%
Mini js (Compiler) 3.5±0.06µs 3.6±0.03µs +2.86%
Mini js (Execution) 1001.5±11.08µs 993.4±6.60µs -0.81%
Mini js (Parser) 25.8±0.08µs 25.9±0.07µs +0.39%
Number Object Access (Compiler) 1067.6±7.98ns 1047.3±2.42ns -1.90%
Number Object Access (Execution) 4.6±0.01µs 4.7±0.09µs +2.17%
Number Object Access (Parser) 11.2±0.04µs 11.2±0.02µs 0.00%
Object Creation (Compiler) 1451.9±4.38ns 1475.1±4.56ns +1.60%
Object Creation (Execution) 6.1±0.03µs 6.2±0.06µs +1.64%
Object Creation (Parser) 9.5±0.01µs 9.5±0.03µs 0.00%
RegExp (Compiler) 1704.0±6.39ns 1709.7±12.69ns +0.33%
RegExp (Execution) 12.6±0.04µs 12.6±0.04µs 0.00%
RegExp (Parser) 10.4±0.08µs 10.4±0.06µs 0.00%
RegExp Creation (Compiler) 1484.4±5.73ns 1463.2±5.27ns -1.43%
RegExp Creation (Execution) 9.4±0.04µs 9.3±0.04µs -1.06%
RegExp Creation (Parser) 8.6±0.10µs 8.7±0.05µs +1.16%
RegExp Literal (Compiler) 1721.0±10.13ns 1691.8±3.98ns -1.70%
RegExp Literal (Execution) 12.5±0.06µs 12.5±0.04µs 0.00%
RegExp Literal (Parser) 8.5±0.06µs 8.5±0.02µs 0.00%
RegExp Literal Creation (Compiler) 1492.2±9.90ns 1477.1±2.91ns -1.01%
RegExp Literal Creation (Execution) 9.4±0.04µs 9.4±0.12µs 0.00%
RegExp Literal Creation (Parser) 6.7±0.03µs 6.8±0.03µs +1.49%
Static Object Property Access (Compiler) 1507.7±2.84ns 1493.7±3.29ns -0.93%
Static Object Property Access (Execution) 6.4±0.06µs 6.4±0.06µs 0.00%
Static Object Property Access (Parser) 10.2±0.04µs 10.2±0.04µs 0.00%
String Object Access (Compiler) 1509.0±8.72ns 1514.7±8.91ns +0.38%
String Object Access (Execution) 8.0±0.13µs 7.9±0.10µs -1.25%
String Object Access (Parser) 13.9±0.05µs 14.0±0.02µs +0.72%
String comparison (Compiler) 2.2±0.01µs 2.3±0.01µs +4.55%
String comparison (Execution) 6.1±0.01µs 6.2±0.03µs +1.64%
String comparison (Parser) 11.3±0.06µs 11.4±0.05µs +0.88%
String concatenation (Compiler) 1702.4±7.55ns 1725.6±4.28ns +1.36%
String concatenation (Execution) 5.4±0.03µs 5.4±0.02µs 0.00%
String concatenation (Parser) 7.9±0.07µs 7.8±0.04µs -1.27%
String copy (Compiler) 1348.1±6.91ns 1370.5±6.51ns +1.66%
String copy (Execution) 5.0±0.04µs 4.8±0.04µs -4.00%
String copy (Parser) 5.9±0.05µs 6.0±0.05µs +1.69%
Symbols (Compiler) 933.7±2.87ns 941.3±2.65ns +0.81%
Symbols (Execution) 4.8±0.02µs 4.9±0.03µs +2.08%
Symbols (Parser) 4.5±0.02µs 4.6±0.06µs +2.22%

@jasonwilliams
Copy link
Member Author

@jedel1043 you happy with this?

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

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

@jedel1043 you happy with this?

Yep :)

@jasonwilliams
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Mar 8, 2022
Added boa examples as per issue #446
Overtaken #634

Somehow screwed that branch up by rebasing it and losing access
pings @elasmojs 

This Pull Request fixes/closes #446 .


Co-authored-by: Jason Williams <jase.williams@gmail.com>
Co-authored-by: Iban Eguia (Razican) <razican@protonmail.ch>
Co-authored-by: jasonwilliams <jase.williams@gmail.com>
Co-authored-by: jedel1043 <jedel0124@gmail.com>
@bors
Copy link

bors bot commented Mar 8, 2022

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Added boa examples [Merged by Bors] - Added boa examples Mar 8, 2022
@bors bors bot closed this Mar 8, 2022
@bors bors bot deleted the examples branch March 8, 2022 01:24
@RageKnify RageKnify added the enhancement New feature or request label Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation update documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add examples
6 participants