0http-bun 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
package/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Introduction
2
- Experimental, bun-based HTTP framework inspired by 0http!
2
+ Experimental, bun-based HTTP framework inspired by [0http](https://0http.21no.de/#/)
3
+
4
+ ![Performance Benchmarks](0http-benchmarks.png)
5
+ > MacBook Pro (13-inch, 2020)
3
6
 
4
7
  ## Usage
5
8
  ```js
@@ -30,7 +33,58 @@ module.exports = {
30
33
  fetch: (request) => router.lookup(request)
31
34
  }
32
35
  ```
33
-
36
+ # Benchmarks
37
+ ## 0http-bun (bun v0.2.2)
38
+ ```
39
+ % wrk -t4 -c50 -d10s --latency http://127.0.0.1:3000/hi
40
+ Running 10s test @ http://127.0.0.1:3000/hi
41
+ 4 threads and 50 connections
42
+ Thread Stats Avg Stdev Max +/- Stdev
43
+ Latency 463.26us 99.23us 4.28ms 96.62%
44
+ Req/Sec 25.98k 1.10k 27.48k 76.73%
45
+ Latency Distribution
46
+ 50% 442.00us
47
+ 75% 466.00us
48
+ 90% 485.00us
49
+ 99% 0.91ms
50
+ 1044377 requests in 10.10s, 127.49MB read
51
+ Requests/sec: 103397.66
52
+ Transfer/sec: 12.62MB
53
+ ```
54
+ ## 0http (node v18.2.0)
55
+ ```
56
+ % wrk -t4 -c50 -d10s --latency http://127.0.0.1:3000/hi
57
+ Running 10s test @ http://127.0.0.1:3000/hi
58
+ 4 threads and 50 connections
59
+ Thread Stats Avg Stdev Max +/- Stdev
60
+ Latency 0.98ms 251.77us 13.04ms 95.09%
61
+ Req/Sec 12.31k 771.37 16.96k 95.29%
62
+ Latency Distribution
63
+ 50% 0.95ms
64
+ 75% 0.96ms
65
+ 90% 0.98ms
66
+ 99% 1.88ms
67
+ 493899 requests in 10.10s, 63.59MB read
68
+ Requests/sec: 48893.32
69
+ Transfer/sec: 6.29MB
70
+ ```
71
+ ## express (node v18.2.0)
72
+ ```
73
+ % wrk -t4 -c50 -d10s --latency http://127.0.0.1:3000/hi
74
+ Running 10s test @ http://127.0.0.1:3000/hi
75
+ 4 threads and 50 connections
76
+ Thread Stats Avg Stdev Max +/- Stdev
77
+ Latency 4.99ms 0.90ms 20.31ms 89.52%
78
+ Req/Sec 2.42k 154.52 2.66k 82.25%
79
+ Latency Distribution
80
+ 50% 4.67ms
81
+ 75% 4.83ms
82
+ 90% 6.03ms
83
+ 99% 8.43ms
84
+ 96296 requests in 10.01s, 21.95MB read
85
+ Requests/sec: 9622.74
86
+ Transfer/sec: 2.19MB
87
+ ```
34
88
  # Support / Donate 💚
35
89
  You can support the maintenance of this project:
36
90
  - PayPal: https://www.paypal.me/kyberneees
@@ -0,0 +1,13 @@
1
+ /* global Response */
2
+ const http = require('../index')
3
+
4
+ const { router } = http({})
5
+
6
+ router.get('/hi', async (req) => {
7
+ return new Response('Hello World!')
8
+ })
9
+
10
+ module.exports = {
11
+ port: 3000,
12
+ fetch: (request) => router.lookup(request)
13
+ }
@@ -55,7 +55,7 @@ module.exports = (config = {}) => {
55
55
  return this
56
56
  }
57
57
 
58
- router.lookup = async (req, step) => {
58
+ router.lookup = (req, step) => {
59
59
  const url = new URL(req.url)
60
60
  req.path = url.pathname || '/'
61
61
  req.query = url.queryparams
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "0http-bun",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "0http alternative for Bun",
5
5
  "main": "index.js",
6
6
  "scripts": {