展示HN:PrinceJS v1.7.7 更新。压缩至 2.2 kB,顶尖(13岁开发者)
嘿,HN(来自我11月21日帖子的更新),
我是来自尼日利亚的Matthew,13岁。在对自动炮进行修正后(感谢@saltyaom!),这是PrinceJS的v1.7.7版本。
自发布以来的新变化:
• 包大小:约2.2 kB(经过gzip压缩,经过树摇优化,减少了600字节)
• 速度:在oha上达到21,748请求/秒(-c 100 -z 30s,Bun 1.2.x)——确认的前三名
• 与其他框架对比:Hono 22,124 | Elysia 25,312 | Express 9,325
完整的服务器代码(8行):
```javascript
import { prince } from "princejs";
const app = prince();
app.get("/", () => "Hello world ");
app.get("/users/:id", (req) => ({ id: req.params.id }));
app.listen(3000);
```
接下来是云虚拟机的基准测试。对包的大小和速度有什么反馈吗?
仓库链接: [https://github.com/MatthewTheCoder1218/princejs](https://github.com/MatthewTheCoder1218/princejs)
安装命令:npm i princejs
Matthew (@Lil_Prince_1218)
查看原文
Hey HN (update from my Nov 21 post),<p>Matthew here, 13 from Nigeria. After the autocannon correction (thx @saltyaom!), here's v1.7.7 of PrinceJS.<p>New since launch:
• Bundle: ~2.2 kB gzipped (tree-shaking tweaks, down 600 bytes)
• Speed: 21,748 req/s on oha (-c 100 -z 30s, Bun 1.2.x) – top 3 confirmed
• Vs others: Hono 22,124 | Elysia 25,312 | Express 9,325<p>Full server (8 lines):
import { prince } from "princejs";
const app = prince();<p>app.get("/", () => "Hello world ");
app.get("/users/:id", (req) => ({ id: req.params.id }));<p>app.listen(3000);<p>Cloud VM benchmarks next. Feedback on size/speed?<p>Repo: <a href="https://github.com/MatthewTheCoder1218/princejs" rel="nofollow">https://github.com/MatthewTheCoder1218/princejs</a>
npm i princejs<p>Matthew (@Lil_Prince_1218)