Skip to content

Commit

Permalink
Use anonymous wasm modules for better performance (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjohnsonpint authored Jun 28, 2024
1 parent 89d86fc commit b01f44c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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

0 comments on commit b01f44c

Please sign in to comment.