File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,14 +41,14 @@ console.log(qs)
4141╔═════════════════════════════════════════╤═════════╤═══════════════════╤═══════════╤══════════════════════════╗
4242║ Slower tests │ Samples │ Result │ Tolerance │ Difference with previous ║
4343╟─────────────────────────────────────────┼─────────┼───────────────────┼───────────┼──────────────────────────╢
44- ║ qs │ 10000 │ 314490.53 op/sec │ ± 1.30 % │ ║
45- ║ query-string │ 10000 │ 335943.68 op/sec │ ± 1.26 % │ + 6.82 % ║
46- ║ URLSearchParams-with-Object.fromEntries │ 10000 │ 841094.46 op/sec │ ± 2.71 % │ + 150.37 % ║
47- ║ URLSearchParams-with-construct │ 10000 │ 1230055.12 op/sec │ ± 3.04 % │ + 46.24 % ║
48- ║ node:querystring │ 10000 │ 1402133.99 op/sec │ ± 4.02 % │ + 13.99 % ║
44+ ║ qs │ 10000 │ 295583.95 op/sec │ ± 1.44 % │ ║
45+ ║ query-string │ 10000 │ 314370.91 op/sec │ ± 1.07 % │ + 6.36 % ║
46+ ║ URLSearchParams-with-Object.fromEntries │ 10000 │ 808356.40 op/sec │ ± 2.45 % │ + 157.13 % ║
47+ ║ URLSearchParams-with-construct │ 10000 │ 1135683.90 op/sec │ ± 3.18 % │ + 40.49 % ║
48+ ║ node:querystring │ 10000 │ 1275958.09 op/sec │ ± 3.88 % │ + 12.35 % ║
4949╟─────────────────────────────────────────┼─────────┼───────────────────┼───────────┼──────────────────────────╢
5050║ Fastest test │ Samples │ Result │ Tolerance │ Difference with previous ║
5151╟─────────────────────────────────────────┼─────────┼───────────────────┼───────────┼──────────────────────────╢
52- ║ fast-querystring │ 10000 │ 1620376.82 op/sec │ ± 3.72 % │ + 15.57 % ║
52+ ║ fast-querystring │ 10000 │ 1492040.49 op/sec │ ± 2.77 % │ + 16.93 % ║
5353╚═════════════════════════════════════════╧═════════╧═══════════════════╧═══════════╧══════════════════════════╝
5454```
Original file line number Diff line number Diff line change 11"use strict" ;
22
3- /**
4- * @callback
5- * @param {string } value
6- * @returns {string }
7- */
8- function decode ( value ) {
9- try {
10- return decodeURIComponent ( value ) ;
11- } catch {
12- return value ;
13- }
14- }
3+ const fastDecode = require ( "fast-decode-uri-component" ) ;
154
165/**
176 * @callback parse
@@ -59,8 +48,8 @@ function parse(input) {
5948
6049 // Optimization: Do not decode if it's not necessary.
6150 if ( shouldDecode ) {
62- key = decode ( key ) ;
63- value = decode ( value ) ;
51+ key = fastDecode ( key ) || key ;
52+ value = fastDecode ( value ) || value ;
6453 }
6554
6655 if ( result [ key ] === undefined ) {
Original file line number Diff line number Diff line change 3030 "repository" : {
3131 "url" : " git+https://github.com/anonrig/fast-querystring.git" ,
3232 "type" : " git"
33+ },
34+ "dependencies" : {
35+ "fast-decode-uri-component" : " ^1.0.1"
3336 }
3437}
You can’t perform that action at this time.
0 commit comments