@raviqqe/stak 0.10.0 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
- package/package.json +1 -1
- package/stak_wasm_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ The miniature, embeddable R7RS Scheme implementation in Rust
|
|
|
11
11
|
Stak Scheme aims to be:
|
|
12
12
|
|
|
13
13
|
- An embeddable Scheme interpreter for Rust with very small memory footprint and reasonable performance
|
|
14
|
+
- Its virtual machine (VM) is written in only 1.2 KLOC in Rust.
|
|
14
15
|
- The minimal implementation of [the R7RS-small standard][r7rs-small]
|
|
15
16
|
- A subset of [Chibi Scheme](https://github.com/ashinn/chibi-scheme), [Gauche](https://github.com/shirok/Gauche), and [Guile](https://www.gnu.org/software/guile/)
|
|
16
17
|
- A portable scripting environment that supports even no-`std` and no-`alloc` platforms
|
|
@@ -166,6 +167,38 @@ fn run_scheme(module: &UniversalModule) -> Result<(), EngineError> {
|
|
|
166
167
|
}
|
|
167
168
|
```
|
|
168
169
|
|
|
170
|
+
## Performance
|
|
171
|
+
|
|
172
|
+
### Computational benchmarks
|
|
173
|
+
|
|
174
|
+
The Stak Scheme interpreter runs 2 to 4 times slower than Python 3 at computationally heavy tasks depending on its configuration and benchmarks. For all the benchmark results, see [the GitHub Action](https://github.com/raviqqe/stak/actions/workflows/bench.yaml).
|
|
175
|
+
|
|
176
|
+
- Baseline: Python 3.12
|
|
177
|
+
- Environment: Ubuntu 24.04, x86-64
|
|
178
|
+
|
|
179
|
+
| Benchmark | Stak (minimal [^1]) | Stak (full [^2]) |
|
|
180
|
+
| ---------------- | ------------------: | ---------------: |
|
|
181
|
+
| Fibonacci number | 2.09x slower | 3.19x slower |
|
|
182
|
+
| Integer sum | 2.26x slower | 3.97x slower |
|
|
183
|
+
| Tak function | 2.41x slower | 4.79x slower |
|
|
184
|
+
|
|
185
|
+
### Startup benchmarks
|
|
186
|
+
|
|
187
|
+
Although Stak Scheme's minimality comes at the cost of speed, it is very fast at startup.
|
|
188
|
+
|
|
189
|
+
This means that Stak Scheme is suitable for embedding many small pieces of Scheme programs in Rust due to its tiny overhead on program initialization.
|
|
190
|
+
|
|
191
|
+
- Baseline: Python 3.12
|
|
192
|
+
- Environment: Ubuntu 24.04, x86-64
|
|
193
|
+
|
|
194
|
+
| Benchmark | Stak (full [^2]) | Lua 5.4 |
|
|
195
|
+
| ------------- | ---------------: | ------: |
|
|
196
|
+
| Empty program | 0.568 us | 26.3 us |
|
|
197
|
+
|
|
198
|
+
[^1]: Minimal: Integer-only support + standard libraries based on libc
|
|
199
|
+
|
|
200
|
+
[^2]: Full: Floating-point number support + standard libraries based on the `std` library in Rust
|
|
201
|
+
|
|
169
202
|
## References
|
|
170
203
|
|
|
171
204
|
- This project is based on [Ribbit Scheme][ribbit], the small and portable R4RS implementation.
|
package/package.json
CHANGED
package/stak_wasm_bg.wasm
CHANGED
|
Binary file
|