Commit Graph

53 Commits

Author SHA1 Message Date
Matt Cowley
925a464cb8
url: remove #context from URLSearchParams
PR-URL: https://github.com/nodejs/node/pull/51520
Fixes: https://github.com/nodejs/node/issues/51518
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2024-01-24 14:36:36 +00:00
Yagiz Nizipli
01dae5f877
lib,src: replace toUSVString with toWellFormed()
PR-URL: https://github.com/nodejs/node/pull/47342
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2023-11-29 16:00:57 +00:00
Yagiz Nizipli
c829c03df2
url: improve invalid url performance
PR-URL: https://github.com/nodejs/node/pull/49692
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-09-26 15:40:17 +00:00
Yagiz Nizipli
cd0fcf20c3
benchmark: differentiate whatwg and legacy url
PR-URL: https://github.com/nodejs/node/pull/47377
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
2023-04-13 21:37:17 +00:00
Khafra
39a08ee8b8 benchmark: lower URL.canParse runs
PR-URL: https://github.com/nodejs/node/pull/47351
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-03-31 17:15:32 -07:00
Khafra
f2651a0812
url: implement URL.canParse
PR-URL: https://github.com/nodejs/node/pull/47179
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
2023-03-22 19:44:44 +00:00
Debadree Chatterjee
28c9fb9592
benchmark: add a benchmark for URLSearchParams creation and toString()
Refs: https://github.com/nodejs/performance/issues/56
PR-URL: https://github.com/nodejs/node/pull/46810
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2023-03-13 10:37:41 +00:00
Antoine du Hamel
3aef395ed5
benchmark: add trailing commas in benchmark/url
PR-URL: https://github.com/nodejs/node/pull/46551
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2023-02-10 00:54:40 +00:00
Antoine du Hamel
e487638406
url: refactor to use more primordials
PR-URL: https://github.com/nodejs/node/pull/45966
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2023-01-22 14:13:24 +01:00
raisinten
3dce4fb85f
test,benchmark: stop requiring URL and URLSearchParams
Since the URL and URLSearchParams classes are available in the
global object, there is no need to require them from 'url'.

PR-URL: https://github.com/nodejs/node/pull/36927
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-01-18 13:44:33 -08:00
Daniele Belardi
a33e9c9d80
benchmark: use let instead of var in url
PR-URL: https://github.com/nodejs/node/pull/31794
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2020-03-30 10:16:20 +02:00
Ruben Bridgewater
bb6125bac7
benchmark: remove special test entries
This reverts commit 7cfbc9f90f.

PR-URL: https://github.com/nodejs/node/pull/31755
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-03-09 22:35:54 +01:00
Anna Henningsen
7cfbc9f90f
Revert "benchmark: remove special test entries"
This reverts commit 357230f4b7.

Refs: https://github.com/nodejs/node/pull/31396
PR-URL: https://github.com/nodejs/node/pull/31722
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2020-02-10 22:35:08 +01:00
Ruben Bridgewater
357230f4b7
benchmark: remove special test entries
It was necessary to have fallbacks to run the original tests. This
is obsolete with the new test mode.

PR-URL: https://github.com/nodejs/node/pull/31396
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-02-09 13:32:12 +01:00
Denys Otrishko
f7a1ef6fb5 benchmark: clean up config resolution in multiple benchmarks
This removes 'to Number' casting in multiple benchmarks (which is
handled by the benchmark runner) and cleans up some var usage in changed
benchmarks.

PR-URL: https://github.com/nodejs/node/pull/31581
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-02-02 19:45:02 -08:00
Alex Ramirez
0d1b14ac19 benchmark: swap var for let in url benchmarks
In benchmark url directory this changes for loops using var to let
when it applies for consistency

PR-URL: https://github.com/nodejs/node/pull/28867
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-07-30 09:37:48 -07:00
Ruben Bridgewater
b08a867d60
benchmark,doc,lib: capitalize more comments
PR-URL: https://github.com/nodejs/node/pull/26849
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2019-03-27 17:20:06 +01:00
Joyee Cheung
a365bb9cb1
benchmark: pre-generate data set for URL benchmarks
This patch:

- Introduces `common.bakeUrlData` which can be used to pre-generate
  the data set for the URL benchmarks to loop through instead of
  looping over a constant.
- Add the option to use WPT data in benchmarks for better diversity
  in the input
- Add the option to benchmark URL parsing with base URLs (whatwg only)
- Moves the data in `benchmark/fixtures/url-inputs.js` to
  `benchmark/common.js`

PR-URL: https://github.com/nodejs/node/pull/24302
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-11-20 05:14:34 +08:00
Sergey Golovin
f3257dd3ea
benchmark: fix benchmark for url
Rename different parameters with the same names to make it possible
to run tests for url benchmarks.

PR-URL: https://github.com/nodejs/node/pull/19084
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-03-11 03:56:17 +01:00
Weijia Wang
3cef3e61d6 url: reduce deplicated codes in autoEscapeStr
PR-URL: https://github.com/nodejs/node/pull/18613
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-02-23 15:46:05 +08:00
Ruben Bridgewater
1a8ed225b2
benchmark: (url) refactor
PR-URL: https://github.com/nodejs/node/pull/18320
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-02-01 10:49:01 +01:00
Ruben Bridgewater
49f5e08188
benchmark: (url) use destructuring
PR-URL: https://github.com/nodejs/node/pull/18250
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-01-23 01:29:16 +01:00
Ruben Bridgewater
e167ab71fb
benchmark: var to const
PR-URL: https://github.com/nodejs/node/pull/13757
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2017-09-19 21:14:38 -03:00
Sebastiaan Deckers
bb29405904
lib,src: fix consistent spacing inside braces
PR-URL: https://github.com/nodejs/node/pull/14162
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-07-21 15:13:47 -04:00
Rich Trott
095c0de94d benchmark,lib,test: use braces for multiline block
For if/else and loops where the bodies span more than one line, use
curly braces.

PR-URL: https://github.com/nodejs/node/pull/13828
Ref: https://github.com/nodejs/node/pull/13623#discussion_r123048602
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-06-23 14:43:20 -07:00
Vse Mozhet Byt
22aa3d4899 benchmark: reduce string concatenations
PR-URL: https://github.com/nodejs/node/pull/12455
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-20 04:46:37 +03:00
Brian White
b76a350a19 url: avoid instanceof for WHATWG URL
PR-URL: https://github.com/nodejs/node/pull/11690
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
2017-04-04 17:36:37 -07:00
Timothy Gu
c515a985ea url: spec-compliant URLSearchParams parser
The entire `URLSearchParams` class is now fully spec-compliant.

PR-URL: https://github.com/nodejs/node/pull/11858
Fixes: https://github.com/nodejs/node/issues/10821
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
2017-03-21 17:27:11 -07:00
Lucas Lago
3129ba2bae benchmark: remove v8ForceOptimization calls
This removes common.v8ForceOptimization calls from url and vm benchmark
files.

PR-URL: https://github.com/nodejs/node/pull/11908
Fixes: https://github.com/nodejs/node/issues/11895
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2017-03-21 10:11:36 +01:00
Timothy Gu
d77a7588cf url: spec-compliant URLSearchParams serializer
PR-URL: https://github.com/nodejs/node/pull/11626
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
2017-03-14 13:14:20 -07:00
Bartosz Sosnowski
c5958d20fd benchmark: remove forced optimization from url
This removes all instances of %OptimizeFunctionOnNextCall from url
benchmarks

PR-URL: https://github.com/nodejs/node/pull/9615
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-03-06 16:32:04 +01:00
Timothy Gu
6123ed5b25 benchmark: add USVString conversion benchmark
PR-URL: https://github.com/nodejs/node/pull/11436
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-28 18:39:24 -08:00
Timothy Gu
d4e1eaf43c benchmark: add url.domainTo*()
PR-URL: https://github.com/nodejs/node/pull/11464
Reviewed-By: Steven R Loomis <srloomis@us.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-24 17:49:46 -08:00
Joyee Cheung
7ee95045dd benchmark: clean up legacy url benchmarks
PR-URL: https://github.com/nodejs/node/pull/11264
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2017-02-15 09:12:30 -08:00
Joyee Cheung
d8ac08a62a benchmark: refactor whatwg-url-properties
PR-URL: https://github.com/nodejs/node/pull/11264
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2017-02-15 09:12:25 -08:00
Joyee Cheung
e571fd4f6c benchmark: move url data to fixtures
PR-URL: https://github.com/nodejs/node/pull/11264
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2017-02-15 09:12:16 -08:00
Timothy Gu
781eb90960 benchmark: add url/url-searchparams-sort.js
PR-URL: https://github.com/nodejs/node/pull/11098
Fixes: https://github.com/nodejs/node/issues/10760
Ref: https://github.com/whatwg/url/issues/26
Ref: https://github.com/whatwg/url/pull/199
Ref: https://github.com/w3c/web-platform-tests/pull/4531
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2017-02-13 20:49:13 -08:00
Joyee Cheung
ab3e0862af benchmark: URLSearchParams v.s. querystring
Add benchmarks to compare the performance between
URLSearchParams and querystring, remove duplicate
benchmarks.

PR-URL: https://github.com/nodejs/node/pull/11170
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
2017-02-09 22:57:53 +08:00
Joyee Cheung
c6b586de33 benchmark: fix first call to URL in useWHATWG
PR-URL: https://github.com/nodejs/node/pull/11170
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
2017-02-09 22:57:15 +08:00
Timothy Gu
590626ba11 benchmark: simplify URLSearchParams import
PR-URL: https://github.com/nodejs/node/pull/11111
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
2017-02-03 12:23:30 -08:00
Timothy Gu
98bb65f641
url: improving URLSearchParams
- add some benchmarks for URLSearchParams
- change URLSearchParams backing store to an array
- add custom inspection for URLSearchParams and its iterators

PR-URL: https://github.com/nodejs/node/pull/10399
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-01-19 11:33:37 -08:00
Joyee Cheung
d4b749b62f benchmark: improve WHATWG URL benchmarks
* add benchmark to compare the performance of getting url
  properties between the WHATWG URL and the legacy implementation
* add benchmark to compare the performance of serializing urls
  between the WHATWG URL and the legacy implementation
* refactor the benchmark for comparing parsing performance
  between the two implementations

PR-URL: https://github.com/nodejs/node/pull/10678
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2017-01-15 20:26:19 +08:00
Rich Trott
a68987c154 benchmark,lib,test: adjust for linting
Formatting changes for upcoming linter update.

PR-URL: https://github.com/nodejs/node/pull/10561
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
2017-01-06 14:36:01 -08:00
Joyee Cheung
b7fadf0fa4 benchmark: add benchmark for WHATWG URL properties
PR-URL: https://github.com/nodejs/node/pull/10408
Fixes: https://github.com/nodejs/node/issues/10376
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-12-29 15:46:50 -08:00
James M Snell
4b312387ea url: adding WHATWG URL support
Implements WHATWG URL support. Example:

```
var u = new url.URL('http://example.org');
```

Currently passing all WHATWG url parsing tests and all but two of the
setter tests. The two setter tests are intentionally skipped for now
but will be revisited.

PR-URL: https://github.com/nodejs/node/pull/7448
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-10-11 12:41:42 -07:00
Rich Trott
08ea9ee56d benchmark: add benchmark for url.format()
PR-URL: https://github.com/nodejs/node/pull/7250
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-06-13 16:17:22 -07:00
Andreas Madsen
f6c505d0b1 benchmark: merge url.js with url-resolve.js
url.js was broken since it didn't use the common.js runner. This fixes
that issue by merging it with url-resolve.js, which also benchmarks
url.resolve.

PR-URL: https://github.com/nodejs/node/pull/5177
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2016-02-26 20:29:05 +11:00
Andreas Madsen
d9079ab801 benchmark: move misc to categorized directories
PR-URL: https://github.com/nodejs/node/pull/5177
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2016-02-26 20:28:45 +11:00
Rich Trott
4bb529d972 benchmark: use strict mode
Apply strict mode to benchmark code.

PR-URL: https://github.com/nodejs/node/pull/5336
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-02-22 11:09:26 -08:00
Ben Noordhuis
aff56cd2b4 lib: micro-optimize url.resolve()
Replace the call to Array#splice() with a faster open-coded version
that creates less garbage.

Add a new benchmark to prove it.  With the change applied, it scores
about 5% higher and that is nothing to sneeze at.

PR-URL: https://github.com/iojs/io.js/pull/184
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2014-12-20 21:33:52 +01:00