deno.land / x / abc@v1.3.3 / benchmarks / app.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { assertEquals } from "../vendor/https/deno.land/std/testing/asserts.ts";import { bench, runBenchmarks,} from "../vendor/https/deno.land/std/testing/bench.ts";import { Application } from "../mod.ts";import paths from "./paths.ts";
const app = new Application();
for (const i of paths) { app.any(i, async (c) => c.path);}
app.start({ port: 8080 });
bench({ name: "simple app", runs: 8, async func(b): Promise<void> { b.start(); const conns = []; for (let i = 0; i < 50; ++i) { conns.push(fetch("http://localhost:8080/").then((resp) => resp.text())); } await Promise.all(conns); for await (const i of conns) { assertEquals(i, "/"); } b.stop(); },});
runBenchmarks().finally(() => { app.close();});
abc

Version Info

Tagged at
2 years ago