Repository navigation
Rename the entries to index.js and index.mjs, and generate index.mjs from the addon - #1342
Conversation
Benchmark:
|
| Scenario | Base req/s | Head req/s | Head / base | Rounds | Noise | Busy | CPU per request |
|---|---|---|---|---|---|---|---|
| http/hello-world | 140783 | 141692 | 1.003x (+0.3%) | 1.00 to 1.01 | ±1.2% | 100% / 100% | 7.10 / 7.05 us (0.997x) |
| http/headers | 120532 | 120622 | 0.999x (-0.1%) | 0.99 to 1.00 | ±0.8% | 100% / 100% | 8.29 / 8.28 us (1.001x) |
| http/json-post | 110658 | 110394 | 1.001x (+0.1%) | 0.99 to 1.01 | ±2.4% | 100% / 100% | 9.03 / 9.05 us (0.999x) |
| http/cached | 157713 | 157871 | 1.005x (+0.5%) | 1.00 to 1.01 | ±1.4% | 100% / 100% | 6.34 / 6.33 us (0.995x) |
| ws/echo-20b | 147093 | 149066 | 1.014x (+1.4%) | 1.00 to 1.02 | ±1.2% | 100% / 100% | 6.79 / 6.70 us (0.987x) |
| ws/echo-4kb | 129536 | 128879 | 0.995x (-0.5%) | 0.97 to 1.03 | ±2.7% | 100% / 100% | 7.71 / 7.75 us (1.005x) |
4 rounds of 3s per scenario, each round loading base, head and a second process of each one, from a copy of its build, after the other, in an order that changes every round. "Head / base" is the median of the per-round ratios of req/s and "Rounds" their range. "Noise" is how far base/base and head/head, the same code on both sides, got from 1 in this same run: that is what the machine did, so a row is marked only when the median moved further than that, at least 2%, and every round moved the same way: 👀 slower, 🏆 faster. "Busy" is the cpu time of the server process over the round and "CPU per request" that time divided by the requests it answered, with the head/base ratio judged against its own same-code band and bold when it cleared it. When busy is well under 100% the load generator set the pace, the req/s are its and the cpu per request is the column to read. Only the ratios are comparable across runs, the absolute figures depend on the runner.
Node v26.10.0, AMD EPYC 9V74 80-Core Processor, 4 cores (server on cpu 0, load on 2,3), http_load_test and load_test with 100 connections.
For #1314.
src/uws.jsbecomessrc/index.js, andbuild.cwritesdist/index.mjswithsrc/esm.jsfrom whatdist/index.jsexports, so the ESM entry cannot go out of date. The build workflow copies both tobinariesand adds them there (commit -askips new files).Examples import
../dist/index.mjs, tests require../dist/index.js. The benchmark still loadsuws.jswhen the base is from before the rename.Test:
tests/esm.mjs, in the build workflow, checks that the ESM default is the CommonJS module, that the named exports are the CommonJS keys with the same values, and that a server started fromrequireand one fromimportboth answer. It fails withoutindex.mjsand with a wrapper that misses an export.If you merge this, please merge also #1343: it points
package.jsononbinariesto the new files. Until thenbinarieskeeps the olduws.jsandESM_wrapper.mjs, which still work but are not updated any more.