Repository navigation
Conversation
Record status, content-type, retry-after, and JSON bodies for the current workerd worker so the Rust port can match them request for request. Co-authored-by: Jowell Young <guza@duck.com>
Port the V4.1 chat encoder and replace the TypeScript fetch handler with a wasm32 worker pinned to Rust 1.94.0. Co-authored-by: Jowell Young <guza@duck.com>
Run fmt, clippy, the encoder tests, the wasm build, and the golden replay. Co-authored-by: Jowell Young <guza@duck.com>
Drop the old sources, the tokenizer-wasm crate, vitest, and the bench now that the Rust worker serves the same requests. Co-authored-by: Jowell Young <guza@duck.com>
Update the development steps and the measurements that changed with the wasm worker. Co-authored-by: Jowell Young <guza@duck.com>
Keep the rewritten README and describe the Rust worker in its development section. Co-authored-by: Jowell Young <guza@duck.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The TypeScript worker and the
tokenizer-wasmcrate are now one Rust worker onwasm32-unknown-unknown.POST /v1/token/countstill returns the recorded status, content type,Retry-After, and JSON body. Rust is pinned to 1.94.0.Measurements
Workerd, seven warm runs after one discard. Handler time is
performance.now()around the fetch call (about 1 ms resolution, not pure CPU). The first request after boot is listed separately.hello, wall median (min)The first 8 KiB request after boot measured 24 ms in the handler, then 9 ms. Gzip stays under 3 MB. Memory stays under 128 MiB. Local workerd did not enforce a CPU-time cutoff, so these figures are isolate wall time.
Behavior
All 299 golden responses match. The
deepseek_v41reasoning-effort text is unchanged because callers see it. A non-numericContent-Lengthis still a platform 500 from workerd, before the worker runs.crypto.getRandomValuesthrows during Wasm startup. The vocab is built in that startup budget, so its map seeds come fromMath.random, which this runtime allows there and which differs per isolate. If both sources fail, startup aborts. The old fixed0xA5seed is gone. Token counts do not depend on the seed.Toolchain
rust-toolchain.tomlis channel1.94.0withwasm32-unknown-unknown. EveryCargo.tomlsetsrust-version = "1.94". CI installs1.94.0.No selected crate's latest release declares a
rust-versionabove 1.94.worker0.8.7,worker-build0.8.7, andwasm-bindgen0.2.129 are current (rust-version1.91, 1.91, and 1.81).tokenizersstays on 0.23.2 rather than 1.0.0-rc.2. That rc publishes norust-version; it is a different encoder, and the fixtures are locked to 0.23.2encode_fast.