mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 19:08:15 +00:00
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:
parent
075854e516
commit
9b2b8df927
34 changed files with 804 additions and 97 deletions
3
ops/optimizer_tests/owned_string.rs
Normal file
3
ops/optimizer_tests/owned_string.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn op_string_length(string: String) -> u32 {
|
||||
string.len() as u32
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue