2.2.1 • Published 10 months ago

fast-path-parse v2.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

fast-path-parse

Fastest route path-to-params parser.

Optimized where it's possible.

Up-to 10x faster than fastest counterpart (aot imports)

Features

Usage

ESM

import parse from 'fast-path-parse/runtime/parse';
// or
import parse from 'fast-path-parse/aot/parse';

// Run this ahead-of-time, not at runtime or hot path
const parsePath = parse('/user/:foo');

// Run this at hot path
parsePath('/user/john');

CJS

const parse = require('fast-path-parse/runtime/parse');
// or
const parse = require('fast-path-parse/aot/parse');

// Run this ahead-of-time, not at runtime or hot path
const parsePath = parse('/user/:foo');

// Run this at hot path
parsePath('/user/john');

Benchmark

It is on my machine, on your machine results may vary. See benchmark folder

3-level parameter

RuntimePathMethodsfast-pathfast-path-compiledpath-to-regexppath-to-tree
Node.js/user/:id/edit/:pagematch16.5M ops24M ops3M ops2M ops
Bun/user/:id/edit/:pagematch15M ops15M ops1M ops2.5M
Node.js/user/:id/edit/:pageparse13.5M ops28M ops3M ops2M ops
Bun/user/:id/edit/:pageparse17M ops23M ops1M ops2.5M

Supported paths

Information about badges

  • ✅ – Done
  • ✍️ – In progress
  • 🕖 – Planned but not started yet
  • ⚠️ – Requires high amount of time
  • ?– Not tested but could work
  • ❌ – Probably does not happen
NameStatusPriorityPerformance
/foo0100%
/foo/bar0100%
/foo/bar-{one,two}⚠️160%
/foo/bar-[one,two]⚠️160%
/foo/bar_*⚠️280%
/foo/bar-*⚠️280%
/foo/bar*⚠️280%
/foo/bar/<id>390%
/foo/task/:bar480%
/foo/:task/:bar470%
/foo/:bar590%
/foo/*690%
/foo/(.*)690%

License

MIT

2.2.1

10 months ago

2.2.0

11 months ago

2.1.5

11 months ago

2.1.4

11 months ago

2.1.3

11 months ago

2.1.2

11 months ago

2.1.1

11 months ago

2.1.0

12 months ago

2.0.2

12 months ago

2.0.1

12 months ago

2.0.0

12 months ago

1.1.0

12 months ago