Skip to main content

wolfram-boost

A transparent turbocharger for wolframclient. One import, zero API changes.

PyPI version Python 3.8+ License: MIT

The official wolframclient gets sluggish with anything beyond tiny data—an 8 MB image takes 1.5 seconds, a short audio clip takes seconds. wolfram-boost swaps out the transport layer so the same data arrives in tens of milliseconds.

No API changes. No new concepts. Just a smoother experience.


The difference

Data size Official wolfram-boost Feels like
Tiny 7 ms 14 ms Same
Small 37 ms 9 ms Snappier
Medium 161 ms 17 ms Smooth
Image (8 MB) 1.5 s 50 ms Lag is gone
Large image (32 MB) 5.8 s 246 ms Actually usable
Heavy (80 MB+) Unusable Under 0.5 s Feels local

Benchmarks: ARM64 Linux, Wolfram Engine 14.3, 20-round median.


Installation

pip install wolfram-boost

Requirements:

· Python ≥ 3.8 · NumPy ≥ 1.20 · wolframclient · Wolfram Engine or Mathematica installed and configured · Linux only (relies on /dev/shm)


Quick start

# Before
from wolframclient.evaluation import WolframLanguageSession

# After
from wolfram_boost import SHMWolframSession

session = SHMWolframSession(
    kernel="/opt/Wolfram/WolframEngine/14.3/Executables/WolframKernel"
)

# Everything else is the same
from wolframclient.language import wl
import numpy as np

img = np.random.rand(4096, 4096, 3).astype(np.float32)
result = session.evaluate(wl.ImageMeasurements(img, "MeanIntensity"))

audio = np.random.randint(-32768, 32767, size=(2, 44100), dtype=np.int16)
result = session.evaluate(wl.Mean(wl.Flatten(audio)))

small = np.random.rand(100, 2)
result = session.evaluate(wl.Mean(wl.Flatten(small)))

session.terminate()

How it works

You don't need to know. But if you're curious:

Your data
    │
    ├── small → normal ZMQ path (no overhead)
    │
    └── large → high-speed bypass → Wolfram Engine
                    │
              files cleaned up automatically

The decision is automatic. You can tweak the threshold if you want:

session = SHMWolframSession(kernel="...", threshold=10*1024)  # 10 KB

Supported data types

Everything you're likely to throw at Wolfram Engine:

float32 · float64 · float16 · int8 · int16 · int32 · int64 · uint8 · uint16 · uint32 · uint64 · complex64 · complex128 · bool


API

SHMWolframSession is a drop-in replacement for WolframLanguageSession. Same methods, same signatures. You can also use the alias BoostSession if you prefer:

from wolfram_boost import BoostSession

Limitations

· Linux only (uses /dev/shm) · Python and Wolfram Engine must run on the same machine · For multi-GB arrays, call np.ascontiguousarray() first


Tests

# Functional smoke test (all data types, cleanup verification)
python3 tests/smoke_test.py

# Benchmark (SHM vs ZMQ)
python3 tests/benchmark_shm_vs_zmq.py

# Extreme stress test (up to 512 MB+)
python3 tests/benchmark_hell.py

License

MIT

Metadata

Release files for wolfram-boost 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wolfram-boost 0.1.0
File Size Uploaded
wolfram_boost-0.1.0.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wolfram-boost 0.1.0
File Interpreter ABI Platform
wolfram_boost-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / wolfram_boost-0.1.0.tar.gz

Download URL wolfram_boost-0.1.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ef0b3f371fedb994008498f26ddd6fc6bb88e9b3c0d708c9c7ee293fc102186f
BLAKE2b-256 checksum
How to use checksums
70d094c0f55726d2d43418c755255f7bd2f69718441547216651ac2b1b13b3a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / wolfram_boost-0.1.0-py3-none-any.whl

Download URL wolfram_boost-0.1.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8bcf1bd6c4913311c43d749370efe6c098dee52e647eff634cc3a281aef8372
BLAKE2b-256 checksum
How to use checksums
4ba3ec6d09e43c721f084059f948f90e0a8333a39ed443e5867e8073d6b4455a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page