Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use anonymous wasm modules for better performance #264

Merged
merged 3 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## UNRELEASED

- Use anonymous wasm modules for better performance [#264](https://github.com/hypermodeAI/runtime/pull/264)


## 2024-06-26 - Version 0.9.4

- Increase batch size for auto-embedding collection texts [#259](https://github.com/hypermodeAI/runtime/pull/259)
Expand Down
7 changes: 5 additions & 2 deletions wasmhost/wasmhost.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"hmruntime/plugins"
"hmruntime/utils"

"github.com/google/uuid"
"github.com/rs/zerolog"
"github.com/tetratelabs/wazero"
wasm "github.com/tetratelabs/wazero/api"
Expand All @@ -36,8 +35,12 @@ func GetModuleInstance(ctx context.Context, plugin *plugins.Plugin, buffers *uti
wErr := io.MultiWriter(&buffers.StdErr, wErrorLog)

// Configure the module instance.
// Note, we use an anonymous module name (empty string) here,
// for concurrency and performance reasons.
// See https://github.com/tetratelabs/wazero/pull/2275
// And https://gophers.slack.com/archives/C040AKTNTE0/p1719587772724619?thread_ts=1719522663.531579&cid=C040AKTNTE0
cfg := wazero.NewModuleConfig().
WithName(plugin.Name() + "_" + uuid.NewString()).
WithName("").
WithSysWalltime().WithSysNanotime().
WithRandSource(rand.Reader).
WithStdout(wOut).WithStderr(wErr)
Expand Down