2.2.1 • Published 11 months ago

fast-path-parse v2.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 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

11 months ago

2.2.0

12 months ago

2.1.5

12 months ago

2.1.4

12 months ago

2.1.3

12 months ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.0

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.1.0

1 year ago