Skip to content

Disable unused wasmtime features#858

Merged
zshipko merged 7 commits intoextism:mainfrom
Nutomic:disable-wasmtime-features
Jul 10, 2025
Merged

Disable unused wasmtime features#858
zshipko merged 7 commits intoextism:mainfrom
Nutomic:disable-wasmtime-features

Conversation

@Nutomic
Copy link
Copy Markdown
Contributor

@Nutomic Nutomic commented Jun 10, 2025

This PR disables all possible dependencies for wasmtime, while the code can still compile. Its possible that some of these removed features should be enabled again if they help with debugging or improve performance. Here you can see all the default features, as well as documentation for each feature flag.

It reduces the number of dependencies from 401 to 366. I didnt check the compile time but it should also be faster.

@Nutomic Nutomic requested a review from zshipko as a code owner June 10, 2025 08:25
@Nutomic
Copy link
Copy Markdown
Contributor Author

Nutomic commented Jul 9, 2025

Is anything else needed to merge this?

@G4Vi G4Vi requested a review from zshipko July 9, 2025 13:25
@zshipko
Copy link
Copy Markdown
Contributor

zshipko commented Jul 9, 2025

My only hesitation is that we will run into some unintended side-effect of removing one of these features. Everything seems to be working as far as I can tell, and it is helpful to remove the unused features that end up bloating libextism.

One that I'm still on the fence about is threads - since it is a default feature it might be best just to bring that one back as well? I don't know if anyone really uses Extism with the wasm threads proposal, but it seems worth supporting.

@Nutomic
Copy link
Copy Markdown
Contributor Author

Nutomic commented Jul 10, 2025

Then how about this change? I added a new feature wasmtime-default-features which is enabled by default and enables all the default features for wasmtime. These can be disabled manually with default-features = false, so we can see if it works or not.

Comment on lines +46 to +60
wasmtime-default-features = [
"wasmtime/async",
"wasmtime/pooling-allocator",
'wasmtime/gc-null',
'wasmtime/profiling',
'wasmtime/parallel-compilation',
'wasmtime/pooling-allocator',
'wasmtime/demangle',
'wasmtime/addr2line',
'wasmtime/debug-builtins',
'wasmtime/runtime',
'wasmtime/component-model',
'wasmtime/threads',
'wasmtime/std',
]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach is nice! I think we can do this instead:

Suggested change
wasmtime-default-features = [
"wasmtime/async",
"wasmtime/pooling-allocator",
'wasmtime/gc-null',
'wasmtime/profiling',
'wasmtime/parallel-compilation',
'wasmtime/pooling-allocator',
'wasmtime/demangle',
'wasmtime/addr2line',
'wasmtime/debug-builtins',
'wasmtime/runtime',
'wasmtime/component-model',
'wasmtime/threads',
'wasmtime/std',
]
wasmtime-default-features = [
"wasmtime/default"
]

I will push up a commit with some small tweaks then will merge this!

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.

2 participants