Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/hugo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
GOWORK: "off"
GOTOOLCHAIN: local
run: |
GOOS=js GOARCH=wasm go build -trimpath -ldflags "-s -w" \
GOOS=js GOARCH=wasm go build -tags rbgo_core -trimpath -ldflags "-s -w" \
-o ../../static/playground/rbgo.wasm github.com/go-embedded-ruby/ruby/cmd/wasm
raw=$(stat -c %s ../../static/playground/rbgo.wasm); gz=$(gzip -9 -c ../../static/playground/rbgo.wasm | wc -c)
echo "rbgo.wasm ($(go list -m -f '{{.Version}}' github.com/go-embedded-ruby/ruby)): $raw bytes, $gz gzipped" | tee -a "$GITHUB_STEP_SUMMARY"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/playground.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
- name: build go-embedded-ruby (js/wasm)
working-directory: playground/rubywasm
run: |
GOOS=js GOARCH=wasm go build -trimpath -ldflags "-s -w" -o "$RUNNER_TEMP/rbgo.wasm" github.com/go-embedded-ruby/ruby/cmd/wasm
GOOS=js GOARCH=wasm go build -tags rbgo_core -trimpath -ldflags "-s -w" -o "$RUNNER_TEMP/rbgo.wasm" github.com/go-embedded-ruby/ruby/cmd/wasm
raw=$(stat -c %s "$RUNNER_TEMP/rbgo.wasm"); gz=$(gzip -9 -c "$RUNNER_TEMP/rbgo.wasm" | wc -c)
echo "rbgo.wasm ($(go list -m -f '{{.Version}}' github.com/go-embedded-ruby/ruby)): $raw bytes, $gz gzipped" | tee -a "$GITHUB_STEP_SUMMARY"
- name: run the proof
Expand All @@ -137,7 +137,7 @@ jobs:
PLAYGROUND_CAPTURE_DIR: ${{ runner.temp }}/captures
PLAYGROUND_RUBY_WASM: ${{ runner.temp }}/rbgo.wasm
# TestRubyAgreesWithGo runs every operation's Ruby program on the
# interpreter. The proof downloads its ~100 MB twice in Chrome: give the
# interpreter. The proof downloads its ~23 MB twice in Chrome: give the
# run more than go test's 10 minutes.
run: go test -count=1 -timeout 30m -v -run 'TestBrowserProof|TestRubyAgreesWithGo' . ./engine
- name: keep the screenshots
Expand Down
9 changes: 6 additions & 3 deletions playground/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,18 @@ calls only the methods of that API.

The interpreter is a second Go program compiled to WebAssembly,
`github.com/go-embedded-ruby/ruby/cmd/wasm`, at the version `rubywasm/go.mod`
pins:
pins, built with the `rbgo_core` tag: the Ruby language and its numeric stack
(NDArray, FFT, Complex, Rational, Set, BigDecimal, Matrix, …) and none of the
gem bindings, which the playground never calls:

```sh
cd rubywasm
GOOS=js GOARCH=wasm go build -trimpath -ldflags="-s -w" \
GOOS=js GOARCH=wasm go build -tags rbgo_core -trimpath -ldflags="-s -w" \
-o ../../static/playground/rbgo.wasm github.com/go-embedded-ruby/ruby/cmd/wasm
```

It is far larger than the playground (about 100 MB, 21 MB gzipped), so the page
The full build was about 100 MB (22 MB gzipped); the core one is about 23 MB
(5.7 MB gzipped). It is still larger than the playground, so the page
never loads it up front: the first time the visitor opens the Ruby tab, the
ViewModel asks the host, the page's `ndarrayRubyLoad` fetches it with a
progress line and bar counting the bytes, and starts it in its own Go runtime
Expand Down
2 changes: 1 addition & 1 deletion playground/browser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func TestBrowserProof(t *testing.T) {
t.Fatal(err)
}
} else {
run("rubywasm", []string{"GOOS=js", "GOARCH=wasm"}, "go", "build", "-trimpath", "-ldflags=-s -w", "-o",
run("rubywasm", []string{"GOOS=js", "GOARCH=wasm"}, "go", "build", "-tags", "rbgo_core", "-trimpath", "-ldflags=-s -w", "-o",
rbgo, "github.com/go-embedded-ruby/ruby/cmd/wasm")
}
execJS, err := os.ReadFile(filepath.Join(runtime.GOROOT(), "lib", "wasm", "wasm_exec.js"))
Expand Down
2 changes: 1 addition & 1 deletion playground/rubywasm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ require (
github.com/go-crdt/collab v0.74.0 // indirect
github.com/go-crdt/crdt v0.55.0 // indirect
github.com/go-datetime/dates v0.1.0 // indirect
github.com/go-embedded-ruby/ruby v0.5.0 // indirect
github.com/go-embedded-ruby/ruby v0.6.0 // indirect
github.com/go-encryptions/unixcrypt v0.1.0 // indirect
github.com/go-facter/facter v0.0.0-20260830120958-454b72e642ab // indirect
github.com/go-fft/fft v0.23.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions playground/rubywasm/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ github.com/go-crdt/crdt v0.55.0 h1:D/LHQ4OgSJRomMvEeYzRwwnP0hnXGngWevXglmpXIxI=
github.com/go-crdt/crdt v0.55.0/go.mod h1:vbfvns9B9FUaMi2sPKzMYttKmbxfgO7EK3Yu82SrlYw=
github.com/go-datetime/dates v0.1.0 h1:Uj8TaTZ09DXdq75EGQ/teFdrXpfVAC3ZDHAPQvPTnaA=
github.com/go-datetime/dates v0.1.0/go.mod h1:KeZ1wUeMScJD6HOvj3hINwbsB+GCSFjJLWcJhrBlwIo=
github.com/go-embedded-ruby/ruby v0.5.0 h1:DcJxu4H6CJC9qr6utIa399Q41eq36Ti/zbqnR8fRaYA=
github.com/go-embedded-ruby/ruby v0.5.0/go.mod h1:QS5klA3N6Wg6nWe90pesNQvRQPw9AXMxBNOi9I6ukCs=
github.com/go-embedded-ruby/ruby v0.6.0 h1:uB+qHsTf+75YtXj2u76IHiNI/2/YYlZ8Gj/caM3ZEZg=
github.com/go-embedded-ruby/ruby v0.6.0/go.mod h1:QS5klA3N6Wg6nWe90pesNQvRQPw9AXMxBNOi9I6ukCs=
github.com/go-encryptions/unixcrypt v0.1.0 h1:XWk4h9uCDd+T2hovOzgO0B2vOdJvAwi9nbOBVb3o62c=
github.com/go-encryptions/unixcrypt v0.1.0/go.mod h1:B1dJSjz3kdxvP7cpi5xSzyxezgBijmtNCUeCKqqDd3o=
github.com/go-facter/facter v0.0.0-20260830120958-454b72e642ab h1:bXPxQDhADpiF/S/8jlRFhVisFPRaxPtPgjibLnOzvsE=
Expand Down
Loading