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

Removed consoles dependency of InternalState #544

Merged
merged 2 commits into from
Jul 7, 2020

Conversation

HalidOdat
Copy link
Member

@HalidOdat HalidOdat commented Jul 3, 2020

What was the problem this the previous implementation?
The problem with keeping the state of console in a internal state is that for every a call to consoles methods we had to first unwrap it. which is not performant also keeping the state in means that when the methods are bound to the object itself an will panic if not state was provided, for example:

console.log(100);
let log = console.log;
log(100); // this will panic "no state was provided"

This Pull Request also fixes/closes #426 by removing print as it is not a part of spec.

@HalidOdat HalidOdat added performance Performance related changes and issues builtins PRs and Issues related to builtins/intrinsics labels Jul 3, 2020
@HalidOdat HalidOdat added this to the v0.10.0 milestone Jul 3, 2020
@codecov
Copy link

codecov bot commented Jul 3, 2020

Codecov Report

Merging #544 into master will increase coverage by 0.11%.
The diff coverage is 20.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #544      +/-   ##
==========================================
+ Coverage   68.33%   68.45%   +0.11%     
==========================================
  Files         172      172              
  Lines       10495    10476      -19     
==========================================
- Hits         7172     7171       -1     
+ Misses       3323     3305      -18     
Impacted Files Coverage Δ
boa/src/builtins/mod.rs 21.42% <0.00%> (ø)
boa_cli/src/main.rs 33.33% <ø> (ø)
boa/src/exec/mod.rs 67.35% <20.00%> (-1.18%) ⬇️
boa/src/builtins/console/mod.rs 30.23% <20.16%> (+3.05%) ⬆️
boa/src/builtins/value/mod.rs 65.51% <0.00%> (+0.22%) ⬆️

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 641dce1...a349f68. Read the comment docs.

@github-actions
Copy link

github-actions bot commented Jul 3, 2020

Benchmark for 1cedd27

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 343.3±25.04ns 341.5±23.92ns +0.53%
Array access (Execution) 13.4±0.75µs 11.7±0.52µs +14.53%
Array creation (Execution) 3.3±0.24ms 3.1±0.16ms +6.45%
Array pop (Execution) 1160.2±105.80µs 1141.9±53.68µs +1.60%
Boolean Object Access (Execution) 4.5±0.21µs 4.5±0.20µs 0.00%
Create Realm 126.8±8.03µs 130.5±6.45µs -2.84%
Dynamic Object Property Access (Execution) 6.2±0.40µs 6.5±0.59µs -4.62%
Expression (Lexer) 1770.5±134.01ns 1757.1±81.45ns +0.76%
Expression (Parser) 4.2±0.32µs 4.1±0.23µs +2.44%
Fibonacci (Execution) 1019.6±49.79µs 898.1±40.93µs +13.53%
For loop (Execution) 22.5±1.25µs 19.5±1.06µs +15.38%
For loop (Lexer) 4.4±0.24µs 4.3±0.24µs +2.33%
For loop (Parser) 11.4±0.49µs 11.5±0.44µs -0.87%
Hello World (Lexer) 788.9±35.59ns 789.4±44.03ns -0.06%
Hello World (Parser) 1855.4±112.60ns 1858.4±124.64ns -0.16%
Long file (Parser) 5.3±0.23ms 5.3±0.16ms 0.00%
Number Object Access (Execution) 3.6±0.23µs 3.6±0.17µs 0.00%
Object Creation (Execution) 5.5±0.32µs 5.6±0.34µs -1.79%
RegExp (Execution) 66.5±4.69µs 66.2±3.26µs +0.45%
RegExp Literal (Execution) 69.8±3.78µs 70.5±3.69µs -0.99%
RegExp Literal Creation (Execution) 65.7±3.68µs 66.4±3.87µs -1.05%
Static Object Property Access (Execution) 5.6±0.29µs 5.7±0.27µs -1.75%
String Object Access (Execution) 7.6±0.56µs 7.5±0.40µs +1.33%
String comparison (Execution) 6.1±0.36µs 6.1±0.39µs 0.00%
String concatenation (Execution) 5.3±0.32µs 5.0±0.23µs +6.00%
String copy (Execution) 4.2±0.24µs 4.2±0.23µs 0.00%
Symbols (Execution) 3.6±0.23µs 3.6±0.23µs 0.00%

@github-actions
Copy link

github-actions bot commented Jul 3, 2020

Benchmark for d5eaa80

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 436.4±16.95ns 429.6±22.44ns +1.58%
Array access (Execution) 15.1±0.75µs 15.0±0.54µs +0.67%
Array creation (Execution) 4.0±0.13ms 4.0±0.11ms 0.00%
Array pop (Execution) 1507.8±51.98µs 1488.6±58.13µs +1.29%
Boolean Object Access (Execution) 5.9±0.49µs 5.9±0.31µs 0.00%
Create Realm 165.9±9.46µs 167.2±5.53µs -0.78%
Dynamic Object Property Access (Execution) 7.9±0.29µs 7.8±0.27µs +1.28%
Expression (Lexer) 2.2±0.08µs 2.3±0.18µs -4.35%
Expression (Parser) 5.5±0.28µs 5.2±0.16µs +5.77%
Fibonacci (Execution) 1186.3±55.56µs 1179.5±45.03µs +0.58%
For loop (Execution) 26.1±11.64µs 24.8±0.82µs +5.24%
For loop (Lexer) 5.6±0.23µs 5.7±0.27µs -1.75%
For loop (Parser) 15.2±0.65µs 15.0±0.61µs +1.33%
Hello World (Lexer) 1044.2±97.41ns 1032.4±50.95ns +1.14%
Hello World (Parser) 2.4±0.10µs 2.4±0.09µs 0.00%
Long file (Parser) 6.8±0.19ms 6.8±0.27ms 0.00%
Number Object Access (Execution) 4.6±0.16µs 4.4±0.12µs +4.55%
Object Creation (Execution) 7.0±0.30µs 7.0±0.32µs 0.00%
RegExp (Execution) 83.6±4.41µs 81.6±3.31µs +2.45%
RegExp Literal (Execution) 87.8±3.86µs 87.4±2.95µs +0.46%
RegExp Literal Creation (Execution) 83.7±3.62µs 84.7±4.16µs -1.18%
Static Object Property Access (Execution) 7.3±0.35µs 7.2±0.30µs +1.39%
String Object Access (Execution) 9.7±0.63µs 9.6±0.37µs +1.04%
String comparison (Execution) 7.8±0.37µs 7.7±0.33µs +1.30%
String concatenation (Execution) 6.5±0.25µs 6.6±0.31µs -1.52%
String copy (Execution) 5.2±0.12µs 5.1±0.20µs +1.96%
Symbols (Execution) 4.5±0.26µs 4.5±0.12µs 0.00%

@HalidOdat HalidOdat merged commit ca0eaea into master Jul 7, 2020
@HalidOdat HalidOdat deleted the remove/console-internal-state branch July 7, 2020 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builtins PRs and Issues related to builtins/intrinsics performance Performance related changes and issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Boa cli print function panics
2 participants