npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

querystringparser

v0.1.1

Published

Extremely fast querystring parser

Downloads

3,411

Readme

Build Status

#Introduction

Extremely fast querystring parser with same API and semantics as qs + DoS Protection.

#Quick start

npm install querystringparser
var querystringparser = require("querystringparser");
querystringparser.parse("foo=bar");

#API

Exactly the same API and semantics are implemented 100% to make comparison fair.

DoS protection checks for input length, amount of total keys and maximum nesting depth of keys.

var qs = require("querystringparser");
qs.maxLength //Maximum amount of characters in the input string to parse: 32768
qs.maxKeys //Maximum amount of key-value pairs in the query string: 256
qs.maxDepth //Maximum nesting depth of keys: 4 e.g. a[b][c][d]=3

a RangeError is thrown when these limits are reached.

#Performance

To run benchmarks run the bench bash script while on the project root.

Platform info:

Windows_NT 6.1.7601 x64
Node.JS 0.11.8
V8 3.21.18.3
Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz × 4

#Parse

Input:

a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&
a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&
a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&
a[]=3&a[]=3&a[]=3&a[]=3&a[ ]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3
&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3
&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3
&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]= 3&a[]=3&a[]=3&a[]=3&a[]=
3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=
3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=
3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=
3& a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3&a[]=3

Results:

querystringparser x 45,415 ops/sec ±0.10% (103 runs sampled)
qs x 3,372 ops/sec ±0.16% (100 runs sampled)

Input:

foo=bar

Results:

querystringparser x 1,708,245 ops/sec ±0.14% (97 runs sampled)
qs x 331,300 ops/sec ±0.19% (101 runs sampled)

Input:

user[name][first]=tj&user[name][last]=holowaychuk

Results:

querystringparser x 336,640 ops/sec ±0.13% (95 runs sampled)
qs x 77,368 ops/sec ±0.16% (100 runs sampled)

Input:

a[]=1&a[]=2&a[]=3

Results:

querystringparser x 1,418,693 ops/sec ±0.14% (98 runs sampled)
qs x 96,978 ops/sec ±0.14% (100 runs sampled)

#Stringify

Input:

{"cht":"p3","chd":"t:60,40","chs":"250x100","chl":"Hello|World"}

Results:

querystringparser x 282,700 ops/sec ±0.21% (99 runs sampled)
qs x 220,947 ops/sec ±0.26% (101 runs sampled)

Input:

{"foo":["bar"],"baz":["1","2","3"]}

Results:

querystringparser x 558,012 ops/sec ±0.42% (94 runs sampled)
qs x 410,148 ops/sec ±0.31% (98 runs sampled)

Input:

{"x":{"y":[{"z":"1","w":"2"}]}}

Results:

querystringparser x 479,991 ops/sec ±0.13% (99 runs sampled)
qs x 346,668 ops/sec ±0.21% (99 runs sampled)

Input:

{"foo":"bar","bar":"baz"}

Results:

querystringparser x 999,859 ops/sec ±0.19% (97 runs sampled)
qs x 690,273 ops/sec ±0.43% (96 runs sampled)