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

WIP: use v8::Value for strings in fast API #945

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lucacasonato
Copy link
Member

In seqonebytestring cases this is currently WAAAYYY slower than previously. It
moderately speeds up other cases. I am relatively confident we can fix this.

// main
running 36 tests
test baseline                                   ... bench:         306 ns/iter (+/- 5)
test bench_op_arraybuffer                       ... bench:       6,165 ns/iter (+/- 276)
test bench_op_bigint                            ... bench:       3,553 ns/iter (+/- 27)
test bench_op_bigint_return                     ... bench:       5,253 ns/iter (+/- 254)
test bench_op_buffer                            ... bench:       3,997 ns/iter (+/- 37)
test bench_op_buffer_jsbuffer                   ... bench:      38,745 ns/iter (+/- 980)
test bench_op_buffer_nofast                     ... bench:      43,536 ns/iter (+/- 833)
test bench_op_external                          ... bench:       3,649 ns/iter (+/- 28)
test bench_op_external_nofast                   ... bench:       9,199 ns/iter (+/- 91)
test bench_op_option_u32                        ... bench:       6,377 ns/iter (+/- 494)
test bench_op_string                            ... bench:       9,621 ns/iter (+/- 227)
test bench_op_string_bytestring                 ... bench:      50,056 ns/iter (+/- 2,717)
test bench_op_string_bytestring_no_side_effects ... bench:      50,244 ns/iter (+/- 6,436)
test bench_op_string_large_1000                 ... bench:     142,834 ns/iter (+/- 2,709)
test bench_op_string_large_1000000              ... bench:     637,223 ns/iter (+/- 7,831)
test bench_op_string_large_utf8_1000            ... bench:   2,276,399 ns/iter (+/- 7,891)
test bench_op_string_large_utf8_1000000         ... bench:  11,121,529 ns/iter (+/- 82,151)
test bench_op_string_onebyte                    ... bench:       3,972 ns/iter (+/- 33)
test bench_op_string_onebyte_large_1000         ... bench:      36,197 ns/iter (+/- 295)
test bench_op_string_onebyte_large_1000000      ... bench:   1,038,117 ns/iter (+/- 140,790)
test bench_op_string_option_u32                 ... bench:      40,460 ns/iter (+/- 821)
test bench_op_u32                               ... bench:       3,682 ns/iter (+/- 79)
test bench_op_v8_global                         ... bench:      30,163 ns/iter (+/- 592)
test bench_op_v8_global_scope                   ... bench:      31,256 ns/iter (+/- 438)
test bench_op_v8_isolate_nofast                 ... bench:       8,938 ns/iter (+/- 98)
test bench_op_v8_local                          ... bench:       3,759 ns/iter (+/- 35)
test bench_op_v8_local_nofast                   ... bench:       7,094 ns/iter (+/- 42)
test bench_op_v8_local_scope                    ... bench:      13,348 ns/iter (+/- 799)
test bench_op_v8_scope                          ... bench:      11,985 ns/iter (+/- 583)
test bench_op_void                              ... bench:       3,495 ns/iter (+/- 32)
test bench_op_void_2x                           ... bench:       3,590 ns/iter (+/- 25)
test bench_op_void_metrics                      ... bench:       5,375 ns/iter (+/- 29)
test bench_op_void_no_side_effects              ... bench:       3,491 ns/iter (+/- 35)
test bench_op_void_nofast                       ... bench:       6,961 ns/iter (+/- 45)
test bench_op_void_nofast_metrics               ... bench:      10,763 ns/iter (+/- 112)
test bench_op_void_nofast_no_side_effects       ... bench:       6,962 ns/iter (+/- 51)

// this pr
running 36 tests
test baseline                                   ... bench:         300 ns/iter (+/- 8)
test bench_op_arraybuffer                       ... bench:       5,776 ns/iter (+/- 309)
test bench_op_bigint                            ... bench:       3,351 ns/iter (+/- 80)
test bench_op_bigint_return                     ... bench:       4,848 ns/iter (+/- 107)
test bench_op_buffer                            ... bench:       3,779 ns/iter (+/- 46)
test bench_op_buffer_jsbuffer                   ... bench:      38,008 ns/iter (+/- 748)
test bench_op_buffer_nofast                     ... bench:      42,417 ns/iter (+/- 923)
test bench_op_external                          ... bench:       3,451 ns/iter (+/- 22)
test bench_op_external_nofast                   ... bench:       8,320 ns/iter (+/- 107)
test bench_op_option_u32                        ... bench:       6,020 ns/iter (+/- 834)
test bench_op_string                            ... bench:      32,722 ns/iter (+/- 1,349)
test bench_op_string_bytestring                 ... bench:      49,294 ns/iter (+/- 789)
test bench_op_string_bytestring_no_side_effects ... bench:      48,040 ns/iter (+/- 1,760)
test bench_op_string_large_1000                 ... bench:     128,966 ns/iter (+/- 2,475)
test bench_op_string_large_1000000              ... bench:     616,682 ns/iter (+/- 5,926)
test bench_op_string_large_utf8_1000            ... bench:   1,935,236 ns/iter (+/- 36,602)
test bench_op_string_large_utf8_1000000         ... bench:   9,848,884 ns/iter (+/- 99,671)
test bench_op_string_onebyte                    ... bench:      23,294 ns/iter (+/- 422)
test bench_op_string_onebyte_large_1000         ... bench:      28,742 ns/iter (+/- 360)
test bench_op_string_onebyte_large_1000000      ... bench:     178,023 ns/iter (+/- 2,295)
test bench_op_string_option_u32                 ... bench:      43,096 ns/iter (+/- 828)
test bench_op_u32                               ... bench:       3,626 ns/iter (+/- 42)
test bench_op_v8_global                         ... bench:      29,646 ns/iter (+/- 514)
test bench_op_v8_global_scope                   ... bench:      30,858 ns/iter (+/- 785)
test bench_op_v8_isolate_nofast                 ... bench:       8,898 ns/iter (+/- 141)
test bench_op_v8_local                          ... bench:       3,937 ns/iter (+/- 39)
test bench_op_v8_local_nofast                   ... bench:       6,996 ns/iter (+/- 85)
test bench_op_v8_local_scope                    ... bench:      13,558 ns/iter (+/- 220)
test bench_op_v8_scope                          ... bench:      12,178 ns/iter (+/- 193)
test bench_op_void                              ... bench:       3,442 ns/iter (+/- 39)
test bench_op_void_2x                           ... bench:       3,543 ns/iter (+/- 86)
test bench_op_void_metrics                      ... bench:       5,531 ns/iter (+/- 44)
test bench_op_void_no_side_effects              ... bench:       3,445 ns/iter (+/- 24)
test bench_op_void_nofast                       ... bench:       6,884 ns/iter (+/- 105)
test bench_op_void_nofast_metrics               ... bench:      10,662 ns/iter (+/- 135)
test bench_op_void_nofast_no_side_effects       ... bench:       6,870 ns/iter (+/- 57)

Main causes for the slow down:

  • in ASCII only and OneByte cases, rusty_v8 still allocates and copies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant