extension_host: Use wasmtime incremental compilation (#30948)
Builds on top of https://github.com/zed-industries/zed/pull/30942 This turns on incremental compilation and decreases extension compilation times by up to another 41% Putting us at roughly 92% improved extension load times from what is in the app today. Because we only have a static engine, I can't reset the cache between every run. So technically the benchmarks are always running with a warmed cache. So the first extension we load will take the 8.8ms, and then any subsequent extensions will be closer to the measured time in this benchmark. This is also measuring the entire load process, not just the compilation. However, since this is the loading we likely think of when thinking about extensions, I felt it was likely more helpful to see the impact on the overall time. This works because our extensions are largely the same Wasm bytecode (SDK code + std lib functions etc) with minor changes in the trait impl. The more different that extensions implementation is, there will be less benefit, however, there will always be a large part of every extension that is always the same across extensions, so this should be a speedup regardless. I used `moka` to provide a bound to the cache. We could use a bare `DashMap`, however if there was some issue this could lead to a memory leak. `moka` has some slight overhead, but makes sure that we don't go over 32mb while using an LRU-style mechanism for deciding which compilation artifacts to keep. I measured our current extensions to take roughly 512kb in the cache. Which means with a cap of 32mb, we can keep roughly 64 *completely novel* extensions with no overlap. Since our extensions will have more overlap than this though, we can actually keep much more in the cache without having to worry about it. #### Before: ``` load/1 time: [8.8301 ms 8.8616 ms 8.8931 ms] change: [-0.1880% +0.3221% +0.8679%] (p = 0.23 > 0.05) No change in performance detected. ``` #### After: ``` load/1 time: [5.1575 ms 5.1726 ms 5.1876 ms] change: [-41.894% -41.628% -41.350%] (p = 0.00 < 0.05) Performance has improved. ``` Release Notes: - N/A
This commit is contained in:
parent
77c2aecf93
commit
4ece4a635f
5 changed files with 223 additions and 15 deletions
|
@ -44,7 +44,9 @@ chrono = { version = "0.4", features = ["serde"] }
|
|||
clap = { version = "4", features = ["cargo", "derive", "string", "wrap_help"] }
|
||||
clap_builder = { version = "4", default-features = false, features = ["cargo", "color", "std", "string", "suggestions", "usage", "wrap_help"] }
|
||||
concurrent-queue = { version = "2" }
|
||||
cranelift-codegen = { version = "0.116", default-features = false, features = ["host-arch", "incremental-cache", "std", "timing", "unwind"] }
|
||||
crc32fast = { version = "1" }
|
||||
crossbeam-epoch = { version = "0.9" }
|
||||
crossbeam-utils = { version = "0.8" }
|
||||
deranged = { version = "0.4", default-features = false, features = ["powerfmt", "serde", "std"] }
|
||||
digest = { version = "0.10", features = ["mac", "oid", "std"] }
|
||||
|
@ -95,6 +97,7 @@ prost-types = { version = "0.9" }
|
|||
rand-c38e5c1d305a1b54 = { package = "rand", version = "0.8", features = ["small_rng"] }
|
||||
rand_chacha = { version = "0.3" }
|
||||
rand_core = { version = "0.6", default-features = false, features = ["std"] }
|
||||
regalloc2 = { version = "0.11", features = ["checker", "enable-serde"] }
|
||||
regex = { version = "1" }
|
||||
regex-automata = { version = "0.4" }
|
||||
regex-syntax = { version = "0.8" }
|
||||
|
@ -132,8 +135,8 @@ url = { version = "2", features = ["serde"] }
|
|||
uuid = { version = "1", features = ["serde", "v4", "v5", "v7"] }
|
||||
wasm-encoder = { version = "0.221", features = ["wasmparser"] }
|
||||
wasmparser = { version = "0.221" }
|
||||
wasmtime = { version = "29", default-features = false, features = ["async", "component-model", "cranelift", "demangle", "gc-drc", "parallel-compilation"] }
|
||||
wasmtime-cranelift = { version = "29", default-features = false, features = ["component-model", "gc-drc"] }
|
||||
wasmtime = { version = "29", default-features = false, features = ["async", "component-model", "cranelift", "demangle", "gc-drc", "incremental-cache", "parallel-compilation"] }
|
||||
wasmtime-cranelift = { version = "29", default-features = false, features = ["component-model", "gc-drc", "incremental-cache"] }
|
||||
wasmtime-environ = { version = "29", default-features = false, features = ["compile", "component-model", "demangle", "gc-drc"] }
|
||||
winnow = { version = "0.7", features = ["simd"] }
|
||||
|
||||
|
@ -168,7 +171,9 @@ chrono = { version = "0.4", features = ["serde"] }
|
|||
clap = { version = "4", features = ["cargo", "derive", "string", "wrap_help"] }
|
||||
clap_builder = { version = "4", default-features = false, features = ["cargo", "color", "std", "string", "suggestions", "usage", "wrap_help"] }
|
||||
concurrent-queue = { version = "2" }
|
||||
cranelift-codegen = { version = "0.116", default-features = false, features = ["host-arch", "incremental-cache", "std", "timing", "unwind"] }
|
||||
crc32fast = { version = "1" }
|
||||
crossbeam-epoch = { version = "0.9" }
|
||||
crossbeam-utils = { version = "0.8" }
|
||||
deranged = { version = "0.4", default-features = false, features = ["powerfmt", "serde", "std"] }
|
||||
digest = { version = "0.10", features = ["mac", "oid", "std"] }
|
||||
|
@ -224,6 +229,7 @@ quote = { version = "1" }
|
|||
rand-c38e5c1d305a1b54 = { package = "rand", version = "0.8", features = ["small_rng"] }
|
||||
rand_chacha = { version = "0.3" }
|
||||
rand_core = { version = "0.6", default-features = false, features = ["std"] }
|
||||
regalloc2 = { version = "0.11", features = ["checker", "enable-serde"] }
|
||||
regex = { version = "1" }
|
||||
regex-automata = { version = "0.4" }
|
||||
regex-syntax = { version = "0.8" }
|
||||
|
@ -267,8 +273,8 @@ url = { version = "2", features = ["serde"] }
|
|||
uuid = { version = "1", features = ["serde", "v4", "v5", "v7"] }
|
||||
wasm-encoder = { version = "0.221", features = ["wasmparser"] }
|
||||
wasmparser = { version = "0.221" }
|
||||
wasmtime = { version = "29", default-features = false, features = ["async", "component-model", "cranelift", "demangle", "gc-drc", "parallel-compilation"] }
|
||||
wasmtime-cranelift = { version = "29", default-features = false, features = ["component-model", "gc-drc"] }
|
||||
wasmtime = { version = "29", default-features = false, features = ["async", "component-model", "cranelift", "demangle", "gc-drc", "incremental-cache", "parallel-compilation"] }
|
||||
wasmtime-cranelift = { version = "29", default-features = false, features = ["component-model", "gc-drc", "incremental-cache"] }
|
||||
wasmtime-environ = { version = "29", default-features = false, features = ["compile", "component-model", "demangle", "gc-drc"] }
|
||||
winnow = { version = "0.7", features = ["simd"] }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue