feat(ops): Fast zero copy string arguments (#16777)

Uses SeqOneByteString optimization to do zero-copy `&str` arguments in
fast calls.

- [x] Depends on https://github.com/denoland/rusty_v8/pull/1129
- [x] Depends on
4036884
- [x] Disable in async ops
- [x] Make it work with owned `String` with an extra alloc in fast path.
- [x] Support `Cow<'_, str>`. Owned for slow case, Borrowed for fast
case

```rust
#[op]
fn op_string_len(s: &str) -> u32 { 
  str.len() as u32 
}
```
This commit is contained in:
Divy Srivastava 2022-12-01 21:29:15 -08:00 committed by GitHub
parent 075854e516
commit 9b2b8df927
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 804 additions and 97 deletions

View file

@ -0,0 +1,3 @@
fn op_string_length(string: String) -> u32 {
string.len() as u32
}