You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,17 @@ Format inspired by [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
8
8
9
9
## [Unreleased]
10
10
11
-
(Nothing yet.)
11
+
### Added
12
+
13
+
-**feat(worker):** Worker pool for CPU-bound tasks; optional `worker` option on Router with `scriptURL` and `poolSize`; `ctx.state.worker.run(payload)` in routes when enabled
14
+
-**docs(worker):** Worker Pool docs (en + id) under Core Concepts, marked Unreleased; VitePress sidebar updated
15
+
-**benchmark(worker):**`main-worker.ts`, `/test-worker` and `/test-cpu` routes, benchmark README in English
16
+
-**test(worker):** Worker pool tests and fixtures (`echo_worker.ts`, `error_worker.ts`)
17
+
18
+
### Changed
19
+
20
+
-**refactor(src):** Clear naming and A–Z sort in `Worker.ts`; JSDoc (ts-js-jsdoc) and constructor docs; Types.ts interfaces/properties sorted A–Z
21
+
-**docs(benchmark):** Benchmark README — one Indonesian sentence translated to English
|`/test`|JSON only, no CPU | Baseline throughput |
42
+
|`/test-cpu`| 50k sqrt loop on main thread | Main-thread CPU cost |
43
+
|`/test-worker`| Same loop in worker pool | Worker offload cost |
40
44
41
-
## Previous Benchmark Results
45
+
Run autocannon against each route (in another terminal):
42
46
43
-
Below: autocannon runs with the older API (MacBook Pro M3 Pro, 11 cores, 18GB RAM). Re-run with the steps above to get numbers for the current codebase.
**Conclusion (test-cpu vs test-worker).** Both routes run the same CPU-bound workload (50k sqrt loop). `/test-cpu` runs it on the main thread and blocks the event loop (~25k req/s, ~199 ms). `/test-worker` offloads the work to a worker pool (~69k req/s, ~72 ms). For CPU-bound tasks, using the worker yields roughly 2.8× higher throughput and ~2.8× lower latency because the main thread stays free to accept and dispatch requests.
0 commit comments