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

Custom JavaScript string rust type #1380

Merged
merged 1 commit into from
Jul 17, 2021
Merged

Custom JavaScript string rust type #1380

merged 1 commit into from
Jul 17, 2021

Conversation

HalidOdat
Copy link
Member

@HalidOdat HalidOdat commented Jun 30, 2021

This Pull Request fixes/closes #1377 .

As per #1376 RcString has been renamed to JsString.

This is similar to Rc<str>. But unlike Rc<str> which stores the length on the stack and a pointer to the data The JsString length and data is stored on the heap. (Rc<str> keeps refcount on the heap anyway) and just an non-null pointer is kept on the stack, so its size is the size of a pointer.

Also added JsString::concat(x, y) function, so we don't have to do JsString::new(format!("{}{}", x, y)) which wastes an allocation.

Moved src/value/rcstring.rs => src/string.rs (like symbol.rs)
Reexport JsString to root level (because its such a common import, like Value)

This should unblock #1373 :)

@HalidOdat HalidOdat added technical debt execution Issues or PRs related to code execution labels Jun 30, 2021
@HalidOdat HalidOdat added this to the v0.13.0 milestone Jun 30, 2021
@HalidOdat HalidOdat marked this pull request as draft June 30, 2021 15:56
@HalidOdat HalidOdat added the enhancement New feature or request label Jun 30, 2021
@github-actions
Copy link

github-actions bot commented Jun 30, 2021

Test262 conformance changes:

Test result master count PR count difference
Total 78,897 78,897 0
Passed 27,954 27,954 0
Ignored 15,616 15,616 0
Failed 35,327 35,327 0
Panics 0 0 0
Conformance 35.43% 35.43% 0.00%

boa/src/value/rcstring.rs Outdated Show resolved Hide resolved
@github-actions
Copy link

Benchmark for 036a20f

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 229.1±0.78ns 311.4±0.70ns -26.43%
Arithmetic operations (Full) 259.4±33.27µs 232.9±0.40µs +11.38%
Array access (Execution) 5.4±0.03µs 5.6±0.01µs -3.57%
Array access (Full) 263.9±5.19µs 258.6±0.47µs +2.05%
Array creation (Execution) 2.3±0.00ms 2.6±0.01ms -11.54%
Array creation (Full) 2.6±0.00ms 2.9±0.01ms -10.34%
Array pop (Execution) 747.2±2.84µs 828.1±3.01µs -9.77%
Array pop (Full) 1198.9±2.13µs 1248.6±3.21µs -3.98%
Boolean Object Access (Execution) 4.5±0.01µs 4.7±0.01µs -4.26%
Boolean Object Access (Full) 272.0±19.62µs 254.7±0.38µs +6.79%
Clean js (Execution) 527.6±3.14µs 553.8±2.83µs -4.73%
Clean js (Full) 813.7±3.30µs 837.4±2.53µs -2.83%
Clean js (Parser) 36.4±1.11µs 36.6±0.06µs -0.55%
Create Realm 363.1±0.21ns 373.8±3.45ns -2.86%
Dynamic Object Property Access (Execution) 4.4±0.01µs 4.5±0.03µs -2.22%
Dynamic Object Property Access (Full) 283.4±36.52µs 254.7±0.81µs +11.27%
Expression (Parser) 6.0±0.06µs 6.0±0.01µs 0.00%
Fibonacci (Execution) 645.0±1.60µs 653.2±1.06µs -1.26%
Fibonacci (Full) 924.6±2.48µs 924.1±2.28µs +0.05%
For loop (Execution) 16.6±0.03µs 18.8±0.06µs -11.70%
For loop (Full) 294.9±35.86µs 266.2±0.79µs +10.78%
For loop (Parser) 52.2±2.28µs 17.5±0.03µs +198.29%
Goal Symbols (Parser) 12.5±0.02µs 12.5±0.02µs 0.00%
Hello World (Parser) 3.4±0.05µs 3.4±0.02µs 0.00%
Long file (Parser) 727.6±0.67ns 719.5±0.44ns +1.13%
Mini js (Execution) 474.0±3.49µs 496.9±2.51µs -4.61%
Mini js (Full) 762.7±8.94µs 780.2±3.44µs -2.24%
Mini js (Parser) 31.6±0.07µs 31.8±0.18µs -0.63%
Number Object Access (Execution) 3.6±0.01µs 3.6±0.01µs 0.00%
Number Object Access (Full) 269.3±33.41µs 246.3±0.65µs +9.34%
Object Creation (Execution) 3.8±0.02µs 3.9±0.02µs -2.56%
Object Creation (Full) 264.6±23.88µs 251.1±1.04µs +5.38%
RegExp (Execution) 9.8±0.06µs 10.2±0.04µs -3.92%
RegExp (Full) 278.4±19.72µs 255.8±0.43µs +8.84%
RegExp Literal (Execution) 9.7±0.02µs 10.1±0.07µs -3.96%
RegExp Literal (Full) 279.3±18.79µs 260.2±0.45µs +7.34%
RegExp Literal Creation (Execution) 8.6±0.02µs 8.7±0.03µs -1.15%
RegExp Literal Creation (Full) 287.0±23.64µs 253.4±0.38µs +13.26%
Static Object Property Access (Execution) 4.0±0.01µs 4.1±0.02µs -2.44%
Static Object Property Access (Full) 277.4±25.73µs 252.5±0.65µs +9.86%
String Object Access (Execution) 5.9±0.01µs 6.4±0.02µs -7.81%
String Object Access (Full) 274.8±38.36µs 256.6±0.82µs +7.09%
String comparison (Execution) 5.3±0.02µs 5.6±0.03µs -5.36%
String comparison (Full) 269.0±26.81µs 254.7±0.32µs +5.61%
String concatenation (Execution) 4.2±0.02µs 4.5±0.03µs -6.67%
String concatenation (Full) 256.0±14.50µs 247.4±0.83µs +3.48%
String copy (Execution) 3.3±0.01µs 3.4±0.02µs -2.94%
String copy (Full) 259.9±27.43µs 241.0±1.21µs +7.84%
Symbols (Execution) 2.9±0.01µs 2.9±0.01µs 0.00%
Symbols (Full) 299.8±45.97µs 234.4±0.64µs +27.90%

@HalidOdat HalidOdat marked this pull request as ready for review June 30, 2021 17:18
@github-actions
Copy link

Benchmark for 7a64912

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 268.9±7.95ns 391.6±49.25ns -31.33%
Arithmetic operations (Full) 291.3±5.50µs 304.0±8.00µs -4.18%
Array access (Execution) 7.1±0.18µs 7.3±0.16µs -2.74%
Array access (Full) 324.8±6.22µs 343.2±15.71µs -5.36%
Array creation (Execution) 2.7±0.06ms 2.9±0.08ms -6.90%
Array creation (Full) 3.0±0.06ms 3.3±0.14ms -9.09%
Array pop (Execution) 882.1±27.25µs 943.1±37.35µs -6.47%
Array pop (Full) 1398.1±38.05µs 1457.7±37.76µs -4.09%
Boolean Object Access (Execution) 5.7±0.11µs 6.2±0.52µs -8.06%
Boolean Object Access (Full) 316.7±15.28µs 334.0±14.05µs -5.18%
Clean js (Execution) 649.6±17.50µs 685.2±22.99µs -5.20%
Clean js (Full) 988.9±21.65µs 1043.3±30.95µs -5.21%
Clean js (Parser) 43.1±0.93µs 43.8±2.00µs -1.60%
Create Realm 430.6±14.35ns 464.0±24.19ns -7.20%
Dynamic Object Property Access (Execution) 5.6±0.17µs 6.0±0.57µs -6.67%
Dynamic Object Property Access (Full) 318.4±9.61µs 337.5±18.96µs -5.66%
Expression (Parser) 7.8±0.42µs 7.4±0.15µs +5.41%
Fibonacci (Execution) 840.8±22.04µs 908.3±31.64µs -7.43%
Fibonacci (Full) 1182.3±19.91µs 1242.1±44.43µs -4.81%
For loop (Execution) 21.4±0.67µs 24.4±0.68µs -12.30%
For loop (Full) 330.5±5.71µs 354.5±32.75µs -6.77%
For loop (Parser) 20.6±0.62µs 20.7±0.40µs -0.48%
Goal Symbols (Parser) 14.8±0.64µs 14.7±0.31µs +0.68%
Hello World (Parser) 4.2±0.15µs 4.2±0.18µs 0.00%
Long file (Parser) 812.0±18.78ns 819.0±27.76ns -0.85%
Mini js (Execution) 572.6±11.11µs 630.1±35.89µs -9.13%
Mini js (Full) 935.6±50.33µs 973.4±30.95µs -3.88%
Mini js (Parser) 37.8±1.36µs 37.8±1.05µs 0.00%
Number Object Access (Execution) 4.5±0.15µs 4.9±0.40µs -8.16%
Number Object Access (Full) 312.2±8.50µs 321.1±10.12µs -2.77%
Object Creation (Execution) 5.0±0.14µs 5.1±0.15µs -1.96%
Object Creation (Full) 312.8±5.89µs 332.0±9.24µs -5.78%
RegExp (Execution) 13.3±0.28µs 12.5±0.61µs +6.40%
RegExp (Full) 322.3±6.79µs 333.9±9.47µs -3.47%
RegExp Literal (Execution) 12.1±0.36µs 12.3±0.36µs -1.63%
RegExp Literal (Full) 324.7±6.79µs 346.7±13.17µs -6.35%
RegExp Literal Creation (Execution) 10.6±0.41µs 10.6±0.40µs 0.00%
RegExp Literal Creation (Full) 319.8±8.57µs 338.1±18.38µs -5.41%
Static Object Property Access (Execution) 5.3±0.32µs 5.4±0.18µs -1.85%
Static Object Property Access (Full) 318.3±10.50µs 338.7±43.28µs -6.02%
String Object Access (Execution) 7.5±0.31µs 8.2±0.25µs -8.54%
String Object Access (Full) 325.4±37.94µs 335.5±22.95µs -3.01%
String comparison (Execution) 6.9±0.18µs 7.2±0.22µs -4.17%
String comparison (Full) 319.4±9.27µs 336.8±17.24µs -5.17%
String concatenation (Execution) 5.5±0.16µs 5.9±0.11µs -6.78%
String concatenation (Full) 311.1±6.22µs 334.1±15.25µs -6.88%
String copy (Execution) 4.4±0.12µs 4.6±0.17µs -4.35%
String copy (Full) 307.4±5.99µs 320.7±7.28µs -4.15%
Symbols (Execution) 3.9±0.26µs 4.0±0.17µs -2.50%
Symbols (Full) 292.0±11.75µs 312.7±23.53µs -6.62%

@github-actions
Copy link

Benchmark for e1af1cd

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 228.8±0.68ns 311.1±0.14ns -26.45%
Arithmetic operations (Full) 228.4±0.31µs 235.7±0.32µs -3.10%
Array access (Execution) 4.7±0.01µs 5.6±0.01µs -16.07%
Array access (Full) 253.2±0.54µs 258.2±0.69µs -1.94%
Array creation (Execution) 2.3±0.00ms 2.6±0.00ms -11.54%
Array creation (Full) 2.5±0.00ms 2.9±0.00ms -13.79%
Array pop (Execution) 746.0±2.57µs 827.3±3.35µs -9.83%
Array pop (Full) 1153.6±1.50µs 1245.9±1.80µs -7.41%
Boolean Object Access (Execution) 4.5±0.01µs 4.6±0.01µs -2.17%
Boolean Object Access (Full) 245.1±0.56µs 250.1±0.35µs -2.00%
Clean js (Execution) 529.3±2.48µs 549.1±4.71µs -3.61%
Clean js (Full) 797.0±2.76µs 830.8±2.34µs -4.07%
Clean js (Parser) 36.3±0.05µs 36.5±0.03µs -0.55%
Create Realm 358.7±0.33ns 326.4±0.31ns +9.90%
Dynamic Object Property Access (Execution) 4.4±0.01µs 4.6±0.01µs -4.35%
Dynamic Object Property Access (Full) 247.3±0.28µs 255.1±0.58µs -3.06%
Expression (Parser) 6.0±0.01µs 6.1±0.00µs -1.64%
Fibonacci (Execution) 645.9±1.44µs 649.2±2.70µs -0.51%
Fibonacci (Full) 930.4±0.74µs 924.1±1.23µs +0.68%
For loop (Execution) 16.6±0.05µs 18.8±0.07µs -11.70%
For loop (Full) 256.5±0.25µs 263.0±0.38µs -2.47%
For loop (Parser) 17.4±0.03µs 17.5±0.02µs -0.57%
Goal Symbols (Parser) 12.6±0.02µs 12.6±0.01µs 0.00%
Hello World (Parser) 3.4±0.01µs 3.4±0.01µs 0.00%
Long file (Parser) 755.7±18.23ns 722.0±3.76ns +4.67%
Mini js (Execution) 471.5±2.93µs 497.0±3.21µs -5.13%
Mini js (Full) 742.8±2.43µs 777.6±2.07µs -4.48%
Mini js (Parser) 31.5±0.06µs 31.9±0.03µs -1.25%
Number Object Access (Execution) 3.5±0.01µs 3.6±0.01µs -2.78%
Number Object Access (Full) 242.0±0.53µs 248.0±0.34µs -2.42%
Object Creation (Execution) 3.8±0.01µs 3.9±0.01µs -2.56%
Object Creation (Full) 242.7±0.70µs 251.6±0.74µs -3.54%
RegExp (Execution) 8.6±0.02µs 9.9±0.10µs -13.13%
RegExp (Full) 252.8±3.19µs 257.0±0.31µs -1.63%
RegExp Literal (Execution) 8.6±0.02µs 10.0±0.03µs -14.00%
RegExp Literal (Full) 255.4±0.67µs 260.2±0.37µs -1.84%
RegExp Literal Creation (Execution) 8.5±0.02µs 8.7±0.04µs -2.30%
RegExp Literal Creation (Full) 249.5±0.26µs 257.7±0.36µs -3.18%
Static Object Property Access (Execution) 4.0±0.01µs 4.0±0.01µs 0.00%
Static Object Property Access (Full) 218.8±2.57µs 253.9±0.78µs -13.82%
String Object Access (Execution) 5.9±0.01µs 6.3±0.02µs -6.35%
String Object Access (Full) 247.9±0.42µs 258.3±0.63µs -4.03%
String comparison (Execution) 5.4±0.02µs 5.6±0.03µs -3.57%
String comparison (Full) 248.3±0.36µs 253.7±0.31µs -2.13%
String concatenation (Execution) 4.2±0.01µs 4.7±0.01µs -10.64%
String concatenation (Full) 240.2±0.33µs 247.9±0.32µs -3.11%
String copy (Execution) 3.3±0.01µs 3.4±0.01µs -2.94%
String copy (Full) 235.8±0.75µs 243.7±0.38µs -3.24%
Symbols (Execution) 2.9±0.02µs 3.0±0.01µs -3.33%
Symbols (Full) 225.6±0.30µs 234.6±1.94µs -3.84%

@HalidOdat
Copy link
Member Author

There seems to be an overall nice increase in performance :)

@HalidOdat HalidOdat added the performance Performance related changes and issues label Jun 30, 2021
@neeldug
Copy link
Contributor

neeldug commented Jun 30, 2021

@HalidOdat just wondering why there should be this strong of a performance improvement, as I'd expect the memory usage to decrease, but due to heap allocations and deallocations being slower than stack shouldn't it have the adverse effect on the runtime?

@HalidOdat
Copy link
Member Author

@HalidOdat just wondering why there should be this strong of a performance improvement, as I'd expect the memory usage to decrease, but due to heap allocations and deallocations being slower than stack shouldn't it have the adverse effect on the runtime?

JsString::concat saves one allocation so that's probably why string concatenation improved Besides that we don't really allocate/deallocate anymore than we did previously. In the benchmarks we can see that the main improvement is in arithmetic operations this is most likely do to the smaller size of Value (from 24 to 16), there are probably other places that have smaller size now, like PropertyKey, Symbol, string property entries, etc.

@github-actions
Copy link

github-actions bot commented Jul 5, 2021

Benchmark for 86883f9

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 229.6±0.11ns 311.2±0.53ns -26.22%
Arithmetic operations (Full) 229.7±4.36µs 230.9±0.44µs -0.52%
Array access (Execution) 5.3±0.10µs 5.6±0.06µs -5.36%
Array access (Full) 249.9±1.16µs 255.2±0.46µs -2.08%
Array creation (Execution) 2.3±0.00ms 2.5±0.00ms -8.00%
Array creation (Full) 2.4±0.00ms 2.6±0.00ms -7.69%
Array pop (Execution) 758.3±2.52µs 793.8±2.87µs -4.47%
Array pop (Full) 1128.7±1.26µs 1173.1±1.57µs -3.78%
Boolean Object Access (Execution) 4.5±0.01µs 4.6±0.01µs -2.17%
Boolean Object Access (Full) 245.1±4.25µs 251.3±0.44µs -2.47%
Clean js (Execution) 525.8±2.83µs 539.2±3.28µs -2.49%
Clean js (Full) 791.6±2.24µs 817.4±2.51µs -3.16%
Clean js (Parser) 35.9±0.02µs 35.9±0.04µs 0.00%
Create Realm 371.2±1.16ns 356.7±3.92ns +4.07%
Dynamic Object Property Access (Execution) 4.3±0.01µs 4.4±0.03µs -2.27%
Dynamic Object Property Access (Full) 247.5±0.53µs 251.8±0.39µs -1.71%
Expression (Parser) 6.1±0.00µs 6.1±0.00µs 0.00%
Fibonacci (Execution) 650.5±1.42µs 651.7±1.11µs -0.18%
Fibonacci (Full) 913.3±1.16µs 925.7±3.40µs -1.34%
For loop (Execution) 16.6±0.16µs 18.7±0.08µs -11.23%
For loop (Full) 257.2±0.40µs 263.9±0.33µs -2.54%
For loop (Parser) 17.3±0.03µs 17.2±0.03µs +0.58%
Goal Symbols (Parser) 12.7±0.02µs 12.6±0.03µs +0.79%
Hello World (Parser) 3.4±0.00µs 3.4±0.01µs 0.00%
Long file (Parser) 736.6±15.87ns 726.2±0.47ns +1.43%
Mini js (Execution) 475.2±22.41µs 489.5±4.63µs -2.92%
Mini js (Full) 738.4±2.38µs 763.7±2.03µs -3.31%
Mini js (Parser) 31.6±0.03µs 31.3±0.05µs +0.96%
Number Object Access (Execution) 3.6±0.01µs 3.6±0.01µs 0.00%
Number Object Access (Full) 239.6±0.78µs 243.5±0.77µs -1.60%
Object Creation (Execution) 3.8±0.02µs 3.8±0.01µs 0.00%
Object Creation (Full) 243.4±0.36µs 245.2±0.89µs -0.73%
RegExp (Execution) 9.5±0.02µs 10.1±0.03µs -5.94%
RegExp (Full) 247.1±0.39µs 255.0±5.91µs -3.10%
RegExp Literal (Execution) 9.4±0.05µs 9.9±0.03µs -5.05%
RegExp Literal (Full) 252.7±0.31µs 256.9±0.49µs -1.63%
RegExp Literal Creation (Execution) 8.2±0.11µs 8.6±0.02µs -4.65%
RegExp Literal Creation (Full) 245.1±0.38µs 251.1±1.49µs -2.39%
Static Object Property Access (Execution) 3.9±0.02µs 4.0±0.01µs -2.50%
Static Object Property Access (Full) 245.6±0.25µs 248.7±0.72µs -1.25%
String Object Access (Execution) 5.9±0.04µs 6.3±0.01µs -6.35%
String Object Access (Full) 247.4±0.40µs 251.3±0.33µs -1.55%
String comparison (Execution) 5.4±0.01µs 5.6±0.01µs -3.57%
String comparison (Full) 247.0±0.24µs 250.5±0.79µs -1.40%
String concatenation (Execution) 4.2±0.01µs 4.5±0.02µs -6.67%
String concatenation (Full) 238.6±2.46µs 243.1±0.28µs -1.85%
String copy (Execution) 3.3±0.01µs 3.4±0.02µs -2.94%
String copy (Full) 237.3±0.27µs 238.5±0.47µs -0.50%
Symbols (Execution) 2.9±0.00µs 2.9±0.00µs 0.00%
Symbols (Full) 223.9±0.43µs 232.0±1.25µs -3.49%

 - Moved src/value/rcstring.rs => src/string.rs
@github-actions
Copy link

Benchmark for fa9197f

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 272.7±0.42ns 372.9±1.03ns -26.87%
Arithmetic operations (Full) 282.0±0.63µs 287.9±0.42µs -2.05%
Array access (Execution) 6.3±0.06µs 6.5±0.14µs -3.08%
Array access (Full) 308.2±0.49µs 315.4±0.76µs -2.28%
Array creation (Execution) 2.6±0.01ms 3.1±0.05ms -16.13%
Array creation (Full) 2.8±0.01ms 3.3±0.00ms -15.15%
Array pop (Execution) 874.4±4.77µs 988.4±7.97µs -11.53%
Array pop (Full) 1331.2±2.37µs 1468.2±1.84µs -9.33%
Boolean Object Access (Execution) 5.4±0.01µs 5.4±0.02µs 0.00%
Boolean Object Access (Full) 302.4±0.45µs 306.2±0.43µs -1.24%
Clean js (Execution) 622.7±7.22µs 658.9±4.99µs -5.49%
Clean js (Full) 958.9±3.17µs 994.6±5.52µs -3.59%
Clean js (Parser) 40.9±0.05µs 40.8±0.06µs +0.25%
Create Realm 438.1±3.87ns 425.2±6.42ns +3.03%
Dynamic Object Property Access (Execution) 5.1±0.03µs 5.3±0.02µs -3.77%
Dynamic Object Property Access (Full) 305.8±0.32µs 310.0±0.76µs -1.35%
Expression (Parser) 7.2±0.01µs 7.1±0.01µs +1.41%
Fibonacci (Execution) 765.7±5.55µs 756.8±9.69µs +1.18%
Fibonacci (Full) 1100.2±2.26µs 1110.8±2.12µs -0.95%
For loop (Execution) 20.2±0.14µs 22.1±0.28µs -8.60%
For loop (Full) 316.5±0.32µs 323.4±0.82µs -2.13%
For loop (Parser) 19.9±0.03µs 19.9±0.04µs 0.00%
Goal Symbols (Parser) 14.3±0.08µs 14.3±0.02µs 0.00%
Hello World (Parser) 4.0±0.03µs 4.0±0.03µs 0.00%
Long file (Parser) 809.6±0.88ns 823.8±2.24ns -1.72%
Mini js (Execution) 560.8±7.49µs 596.1±5.25µs -5.92%
Mini js (Full) 891.3±3.55µs 928.4±3.61µs -4.00%
Mini js (Parser) 35.7±0.29µs 35.6±0.06µs +0.28%
Number Object Access (Execution) 4.2±0.01µs 4.2±0.05µs 0.00%
Number Object Access (Full) 297.6±0.75µs 301.8±0.62µs -1.39%
Object Creation (Execution) 4.5±0.05µs 4.5±0.07µs 0.00%
Object Creation (Full) 300.5±0.51µs 308.5±0.64µs -2.59%
RegExp (Execution) 12.6±0.05µs 13.1±0.12µs -3.82%
RegExp (Full) 308.4±0.78µs 314.1±0.55µs -1.81%
RegExp Literal (Execution) 12.6±0.04µs 12.9±0.09µs -2.33%
RegExp Literal (Full) 316.9±0.64µs 322.4±0.79µs -1.71%
RegExp Literal Creation (Execution) 9.9±0.03µs 10.1±0.05µs -1.98%
RegExp Literal Creation (Full) 305.4±0.84µs 311.5±0.50µs -1.96%
Static Object Property Access (Execution) 4.8±0.08µs 4.8±0.03µs 0.00%
Static Object Property Access (Full) 301.8±0.45µs 307.0±0.77µs -1.69%
String Object Access (Execution) 6.9±0.07µs 7.6±0.02µs -9.21%
String Object Access (Full) 307.3±0.65µs 311.0±0.67µs -1.19%
String comparison (Execution) 6.4±0.02µs 6.6±0.08µs -3.03%
String comparison (Full) 304.0±0.40µs 308.3±0.45µs -1.39%
String concatenation (Execution) 5.0±0.01µs 5.4±0.05µs -7.41%
String concatenation (Full) 295.9±0.45µs 303.1±0.38µs -2.38%
String copy (Execution) 4.0±0.02µs 4.1±0.01µs -2.44%
String copy (Full) 293.0±1.25µs 296.7±0.47µs -1.25%
Symbols (Execution) 3.5±0.03µs 3.5±0.04µs 0.00%
Symbols (Full) 276.5±0.49µs 285.7±0.77µs -3.22%

@HalidOdat HalidOdat merged commit be4a872 into master Jul 17, 2021
@HalidOdat HalidOdat deleted the thin-jsstring branch July 17, 2021 10:32
@github-actions
Copy link

Benchmark for b2e955d

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 266.7±8.13ns 371.4±3.34ns -28.19%
Arithmetic operations (Full) 281.9±0.64µs 283.4±4.86µs -0.53%
Array access (Execution) 6.3±0.09µs 6.4±0.18µs -1.56%
Array access (Full) 301.0±6.48µs 306.1±5.83µs -1.67%
Array creation (Execution) 2.7±0.02ms 2.8±0.05ms -3.57%
Array creation (Full) 3.0±0.07ms 3.1±0.07ms -3.23%
Array pop (Execution) 901.0±9.13µs 917.6±11.14µs -1.81%
Array pop (Full) 1382.3±30.46µs 1444.7±14.64µs -4.32%
Boolean Object Access (Execution) 5.4±0.08µs 5.5±0.07µs -1.82%
Boolean Object Access (Full) 298.0±4.03µs 300.6±6.60µs -0.86%
Clean js (Execution) 605.9±15.42µs 645.3±7.01µs -6.11%
Clean js (Full) 962.9±5.84µs 981.7±16.21µs -1.92%
Clean js (Parser) 39.7±0.82µs 38.7±1.40µs +2.58%
Create Realm 424.8±1.87ns 421.5±10.96ns +0.78%
Dynamic Object Property Access (Execution) 5.3±0.05µs 5.4±0.05µs -1.85%
Dynamic Object Property Access (Full) 302.0±3.43µs 313.5±3.77µs -3.67%
Expression (Parser) 7.0±0.18µs 7.3±0.06µs -4.11%
Fibonacci (Execution) 751.6±12.36µs 733.6±20.50µs +2.45%
Fibonacci (Full) 1022.6±35.76µs 1074.4±26.68µs -4.82%
For loop (Execution) 19.7±0.39µs 21.2±0.81µs -7.08%
For loop (Full) 298.0±11.30µs 322.0±3.34µs -7.45%
For loop (Parser) 18.6±0.57µs 19.3±0.36µs -3.63%
Goal Symbols (Parser) 14.1±0.19µs 13.9±0.37µs +1.44%
Hello World (Parser) 3.7±0.11µs 3.9±0.05µs -5.13%
Long file (Parser) 780.9±18.30ns 775.5±18.80ns +0.70%
Mini js (Execution) 546.0±17.30µs 575.2±13.54µs -5.08%
Mini js (Full) 888.7±9.95µs 912.8±14.61µs -2.64%
Mini js (Parser) 35.4±0.31µs 33.7±1.21µs +5.04%
Number Object Access (Execution) 4.2±0.05µs 4.3±0.06µs -2.33%
Number Object Access (Full) 293.0±3.48µs 300.4±2.92µs -2.46%
Object Creation (Execution) 4.5±0.06µs 4.6±0.06µs -2.17%
Object Creation (Full) 291.0±5.59µs 308.5±2.15µs -5.67%
RegExp (Execution) 12.4±0.45µs 12.2±0.36µs +1.64%
RegExp (Full) 304.9±2.51µs 316.3±2.98µs -3.60%
RegExp Literal (Execution) 12.6±0.42µs 12.1±0.41µs +4.13%
RegExp Literal (Full) 313.0±7.31µs 321.6±1.83µs -2.67%
RegExp Literal Creation (Execution) 9.8±0.15µs 9.8±0.26µs 0.00%
RegExp Literal Creation (Full) 300.8±3.90µs 312.2±2.22µs -3.65%
Static Object Property Access (Execution) 4.9±0.04µs 4.8±0.07µs +2.08%
Static Object Property Access (Full) 293.8±5.53µs 304.6±3.64µs -3.55%
String Object Access (Execution) 6.8±0.16µs 7.6±0.09µs -10.53%
String Object Access (Full) 301.8±2.64µs 306.9±5.05µs -1.66%
String comparison (Execution) 6.5±0.05µs 6.7±0.16µs -2.99%
String comparison (Full) 299.8±3.27µs 303.4±5.92µs -1.19%
String concatenation (Execution) 5.0±0.13µs 5.4±0.12µs -7.41%
String concatenation (Full) 292.8±3.07µs 303.9±4.07µs -3.65%
String copy (Execution) 4.1±0.05µs 3.9±0.09µs +5.13%
String copy (Full) 286.7±4.79µs 299.9±2.41µs -4.40%
Symbols (Execution) 3.5±0.05µs 3.4±0.13µs +2.94%
Symbols (Full) 268.7±6.09µs 283.9±3.38µs -5.35%

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 performance Performance related changes and issues technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom JavaScript string rust type
3 participants