mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 15:51:12 +00:00
Use ArrayString for small string optimization in editor AST
This commit is contained in:
parent
8d19eb695c
commit
b0ad4ec43a
3 changed files with 16 additions and 4 deletions
11
Cargo.lock
generated
11
Cargo.lock
generated
|
@ -91,6 +91,15 @@ dependencies = [
|
||||||
"pretty_assertions",
|
"pretty_assertions",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "arraystring"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4d517c467117e1d8ca795bc8cc90857ff7f79790cca0e26f6e9462694ece0185"
|
||||||
|
dependencies = [
|
||||||
|
"typenum",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arrayvec"
|
name = "arrayvec"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
|
@ -2358,6 +2367,7 @@ dependencies = [
|
||||||
name = "roc_editor"
|
name = "roc_editor"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"arraystring",
|
||||||
"bumpalo",
|
"bumpalo",
|
||||||
"env_logger 0.7.1",
|
"env_logger 0.7.1",
|
||||||
"futures",
|
"futures",
|
||||||
|
@ -2389,7 +2399,6 @@ dependencies = [
|
||||||
"roc_unify",
|
"roc_unify",
|
||||||
"roc_uniq",
|
"roc_uniq",
|
||||||
"target-lexicon",
|
"target-lexicon",
|
||||||
"tokio",
|
|
||||||
"wgpu",
|
"wgpu",
|
||||||
"wgpu_glyph",
|
"wgpu_glyph",
|
||||||
"winit",
|
"winit",
|
||||||
|
|
|
@ -28,7 +28,7 @@ im = "14" # im and im-rc should always have the same version!
|
||||||
im-rc = "14" # im and im-rc should always have the same version!
|
im-rc = "14" # im and im-rc should always have the same version!
|
||||||
bumpalo = { version = "3.2", features = ["collections"] }
|
bumpalo = { version = "3.2", features = ["collections"] }
|
||||||
inlinable_string = "0.1"
|
inlinable_string = "0.1"
|
||||||
tokio = { version = "0.2", features = ["blocking", "fs", "sync", "rt-threaded", "process", "io-driver"] }
|
arraystring = "0.3.0"
|
||||||
# NOTE: rtfeldman/inkwell is a fork of TheDan64/inkwell which does not change anything.
|
# NOTE: rtfeldman/inkwell is a fork of TheDan64/inkwell which does not change anything.
|
||||||
#
|
#
|
||||||
# The reason for this fork is that the way Inkwell is designed, you have to use
|
# The reason for this fork is that the way Inkwell is designed, you have to use
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use arraystring::{typenum::U14, ArrayString};
|
||||||
use inlinable_string::string_ext::StringExt;
|
use inlinable_string::string_ext::StringExt;
|
||||||
use inlinable_string::InlinableString;
|
use inlinable_string::InlinableString;
|
||||||
use roc_types::subs::Variable;
|
use roc_types::subs::Variable;
|
||||||
|
@ -267,8 +268,10 @@ pub enum Expr2 {
|
||||||
text_bytes: *const u8,
|
text_bytes: *const u8,
|
||||||
var: Variable,
|
var: Variable,
|
||||||
},
|
},
|
||||||
Str {
|
SmallStr(ArrayString<U14>),
|
||||||
bytes: [u8; 15],
|
BigStr {
|
||||||
|
bytes: *const u8,
|
||||||
|
len: u32,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue