Skip to content

Instantly share code, notes, and snippets.

// This is a proof of concept implementation since
// Mapl doesn't have built-in signer yet
import { jitc, router, staticException } from '@mapl/app';
import jwt from 'jsonwebtoken';
import Signer from '@bit-js/ncrypt/basic-signer';
import ValueSigner from '@bit-js/ncrypt/value-signer';
const SECRET = 'linux';
import { group, run, bench } from 'mitata';
// Do warmup
for (let i = 0; i < 10; i++) bench('noop', () => { });
group('Set vs array vs literal', () => {
// Do checks with arrays
const arr = ['hi', 'there', 'nagna', 'randomlongstring', 'small'];
const arrInclude = (item) => arr.includes(item);
@aquapi
aquapi / compact.txt
Last active November 20, 2023 16:11
Benchmark results
Stric x 45827 req/sec
Vix x 45412 req/sec
Elysia x 44004 req/sec
Hono x 42643 req/sec
Bunicorn x 39660 req/sec
Fastest is Stric.
@aquapi
aquapi / stric.ts
Last active August 10, 2023 19:17
Stric example code
import { Router, macro } from '@stricjs/router';
import { qs } from '@stricjs/utils';
// Create a query parser that only search for key `name` in the query
const parse = qs.searchKey('name');
export default new Router({ base: 'http://localhost:3000' })
// Return 'Hi' on every requests to '/'
.get('/', macro('Hi'))
// Yield back the JSON that the request sent