Commit Graph

58 Commits

Author SHA1 Message Date
Rafael Gonzaga
80a989f931
lib: add util.getCallSite() API
PR-URL: https://github.com/nodejs/node/pull/54380
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Claudio Wunder <cwunder@gnome.org>
Reviewed-By: James M Snell <jasnell@gmail.com>
2024-09-04 19:47:25 +00:00
Rafael Gonzaga
bda66ad711
benchmark: add style-text benchmark
PR-URL: https://github.com/nodejs/node/pull/52004
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2024-03-09 14:01:04 +00:00
Lei Shi
cd71838675
benchmark: update interations and len in benchmark/util/text-decoder.js
Fixes: https://github.com/nodejs/node/issues/50571
PR-URL: https://github.com/nodejs/node/pull/50938
Refs: https://github.com/nodejs/node/issues/50571
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2023-12-04 14:38:36 +00:00
Lei Shi
36a75e8b39
benchmark: update iterations of benchmark/util/type-check.js
Fixes: https://github.com/nodejs/node/issues/50571
PR-URL: https://github.com/nodejs/node/pull/50937
Refs: https://github.com/nodejs/node/issues/50571
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2023-12-04 14:38:26 +00:00
Lei Shi
c510e2677d
benchmark: update iterations in benchmark/util/normalize-encoding.js
Fixes: https://github.com/nodejs/node/issues/50571
PR-URL: https://github.com/nodejs/node/pull/50934
Refs: https://github.com/nodejs/node/issues/50571
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2023-12-04 14:38:05 +00:00
Lei Shi
964046d3b2
benchmark: update iterations in benchmark/util/inspect-array.js
Fixes: https://github.com/nodejs/node/issues/50571
PR-URL: https://github.com/nodejs/node/pull/50933
Refs: https://github.com/nodejs/node/issues/50571
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2023-12-04 14:37:54 +00:00
Lei Shi
b2f23f0bd0
benchmark: update iterations in benchmark/util/format.js
Fixes: https://github.com/nodejs/node/issues/50571
PR-URL: https://github.com/nodejs/node/pull/50932
Refs: https://github.com/nodejs/node/issues/50571
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2023-12-04 14:37:44 +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
kylo5aby
cdb6519ccd
benchmark: update number of iterations for util.inspect
PR-URL: https://github.com/nodejs/node/pull/50651
Refs: https://github.com/nodejs/node/issues/50571
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2023-11-29 11:09:28 +01:00
Liu Jia
f8c27e6176
benchmark: update iterations in benchmark/util/splice-one.js
Increase the number of iterations from 1e5 to 5e6
to avoid the test performance gap caused by inactive
V8 optimization caused by insufficient number of iterations

Refs: https://github.com/nodejs/node/issues/50571
PR-URL: https://github.com/nodejs/node/pull/50698
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2023-11-26 13:42:55 +00:00
Joyee Cheung
044021d341
benchmark: stablize encode benchmark
- Increase the number of iteration to 1e6 to reduce flakes. 1e4
  can introduce flakes even when comparing the main branch
  against itself
- Replace the 1024 * 32 length test with 1024 * 8 since it would
  otherwise take too long to complete. Remove the 16 length test
  since it's not too different from 32.
- Check the results of the encoding methods at the end.

PR-URL: https://github.com/nodejs/node/pull/46658
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2023-03-07 22:45:40 +01:00
Antoine du Hamel
83cc1e2c8b
benchmark: add trailing commas in benchmark/util
PR-URL: https://github.com/nodejs/node/pull/46438
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-02-03 11:42:25 +01:00
Yagiz Nizipli
2ef13b8fb6 util: add fast path for text-decoder fatal flag
PR-URL: https://github.com/nodejs/node/pull/45803
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2022-12-22 20:22:28 +00:00
Yagiz Nizipli
b06fd8cd45
benchmark: add variety of inputs to text-encoder
PR-URL: https://github.com/nodejs/node/pull/45787
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
2022-12-10 14:45:22 +00:00
Yagiz Nizipli
cb96a130a5
benchmark: add text-encoder benchmark
PR-URL: https://github.com/nodejs/node/pull/45450
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2022-11-18 19:48:01 +00:00
Yagiz Nizipli
86a5b71dc9 benchmark: add parameters to text-decoder benchmark
PR-URL: https://github.com/nodejs/node/pull/45363
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2022-11-09 14:17:30 +00:00
Yagiz Nizipli
e3b3c4697c benchmark: fix text-decoder benchmark
PR-URL: https://github.com/nodejs/node/pull/45363
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2022-11-09 14:17:29 +00:00
Yagiz Nizipli
e14321bb50
util: improve textdecoder decode performance
PR-URL: https://github.com/nodejs/node/pull/45294
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2022-11-06 20:27:41 +00:00
XadillaX
0ee0ed12c1 benchmark: add util.toUSVString()'s benchmark
PR-URL: https://github.com/nodejs/node/pull/40203
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
2021-09-27 17:24:19 +08:00
Daniele Belardi
d9a77c6416
benchmark: use let instead of var in util
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:21 +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
Ruben Bridgewater
1760c23f75
benchmark: add test and all options and improve errors"
This reverts commit 4671d551cf and
contains a fix to the issue raised for the revert.

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:53 +01:00
Anna Henningsen
4671d551cf
Revert "benchmark: add test and all options and improve errors"
This reverts commit dac579516c.

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:35 +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
Ruben Bridgewater
dac579516c
benchmark: add test and all options and improve errors
This adds a new `test` option. Using it automatically uses a single
minimal option matrix to verify the benchmark works as expected.

Using the new `all` option makes sure all test suites are run.

On top of that the benchmarks will from now on report properly
what category might have a typo, if any.

The http duration was also refactored to use a option instead of
relying on a configuration setting.

The fixture folder is ignored as test suite from now on.

PR-URL: https://github.com/nodejs/node/pull/31396
Fixes: https://github.com/nodejs/node/issues/31083
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-02-09 13:31:45 +01:00
Ruben Bridgewater
c430aebe86
util: improve performance inspecting proxies
This makes sure we do not retrieve the handler in case it's not
required. This improves the performance a tiny bit for these cases.

PR-URL: https://github.com/nodejs/node/pull/30767
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-12-07 00:38:28 +01:00
Ruben Bridgewater
bdb1083ef5
benchmark: add more util inspect and format benchmarks
This adds a couple of benchmarks to check different options and code
paths.

PR-URL: https://github.com/nodejs/node/pull/30767
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-12-07 00:38:27 +01:00
Alex Ramirez
d349ba29ef benchmark: swap var for let in util benchmarks
In benchmark util 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:38:00 -07:00
Roman Reiss
55b80f9029
tools: enable block-scoped-var eslint rule
PR-URL: https://github.com/nodejs/node/pull/27616
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-05-10 16:58:49 +02:00
Rich Trott
29e74d4952 benchmark: refactor for consistent style
Code in benchmark directory sometimes uses `function () {}` for
anonymous callbacks and sometimes uses `() => {}`. Multi-line arrays
sometimes have a trailing comma and sometimes do not. Update to always
use arrow functions for anonymous callbacks and trailing commas for
multiline arrays.

PR-URL: https://github.com/nodejs/node/pull/25944
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-06 22:18:31 -08:00
cjihrig
ff8db70bc2
benchmark: add common.binding()
Recently, process.binding() was replaced with internalBinding().
However, internalBinding() is not available on older builds of
Node, which are often used for benchmarking purposes. This commit
adds a common.binding() to the benchmarks to work around the
issue. Hopefully, this can be removed in the not too distant
future.

PR-URL: https://github.com/nodejs/node/pull/23460
Fixes: https://github.com/nodejs/node/issues/23436
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-10-14 13:23:16 -04:00
Ruben Bridgewater
de33a5aa6e
benchmark: refactor util benchmarks
This significantly reduces the benchmark runtime. It removes to many
variations that do not provide any benefit and reduces the iterations.

PR-URL: https://github.com/nodejs/node/pull/22503
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2018-09-07 19:58:36 +02:00
cjihrig
7e4b0a4850
util: make util binding internal
Refs: https://github.com/nodejs/node/issues/22160
PR-URL: https://github.com/nodejs/node/pull/22675
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-09-05 21:53:11 -04:00
Brian White
ce5157b22f
lib: remove usc-2 encoding
Fixes: https://github.com/nodejs/node/issues/21963
PR-URL: https://github.com/nodejs/node/pull/21964
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-07-27 21:03:11 +02:00
MaleDong
a478259af7 test,util: add missing tests and conditions
1) Add missing unit tests by `ucs-2` in different kinds of cases.
2) Add missing unit tests by `usc-2` in different kinds of cases.
3) Fix a bug:We cannot find `ucs-2` in `case 5`'s `if` condition after
`toLowerCase()`

PR-URL: https://github.com/nodejs/node/pull/21455
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-07-08 12:27:16 -07:00
Anatoli Papirovski
6f6f7f749b
lib: add internal PriorityQueue class
An efficient JS implementation of a binary heap on top of an array with
worst-case O(log n) runtime for all operations, including arbitrary
item removal (unlike O(n) for most binary heap array implementations).

PR-URL: https://github.com/nodejs/node/pull/20555
Fixes: https://github.com/nodejs/node/issues/16105
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-05-22 23:24:37 +04:00
Anatoli Papirovski
b04d0921ae
util: improve spliceOne perf
Do less variable allocations and reassignments inside spliceOne
since it's relied on by some performance sensitive code.

PR-URL: https://github.com/nodejs/node/pull/20453
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-05-03 14:47:17 +02:00
Ruben Bridgewater
1b6cb94761
benchmark: refactor
PR-URL: https://github.com/nodejs/node/pull/18320
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-02-01 10:49:04 +01:00
Ruben Bridgewater
7a24b1c565
benchmark: (util/v8/vm) 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:17 +01:00
Sarah Meyer
50fe1a8409 tools, benchmark: test util benchmark
Create a minimal test for the util benchmark files.

PR-URL: https://github.com/nodejs/node/pull/16050
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2017-10-28 13:56:44 -07:00
Brian White
d545c948c2
util: use faster -0 check
PR-URL: https://github.com/nodejs/node/pull/15726
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
2017-10-04 03:51:44 -04:00
Timothy Gu
f547db131f
benchmark: add util/type-check
PR-URL: https://github.com/nodejs/node/pull/15663
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-01 23:58:59 -03: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
Ruben Bridgewater
faaefa8082
util: improve format performance
PR-URL: https://github.com/nodejs/node/pull/15422
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-09-19 20:05:27 -03:00
Ruben Bridgewater
6bfc439711
benchmark: improve and add more inspect benchmarks
PR-URL: https://github.com/nodejs/node/pull/14881
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2017-09-14 21:46:25 -03:00
Ruben Bridgewater
95bbb68175
util: improve util.inspect performance
* improve util.inspect performance
  This is a huge performance improvement in case of sparse arrays
  when using util.inspect as the hole will simple be skipped.

* use faster visibleKeys property lookup

* add inspect-array benchmark

PR-URL: https://github.com/nodejs/node/pull/14492
Fixes: https://github.com/nodejs/node/issues/14487
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-08-13 13:52:33 -04: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
Vse Mozhet Byt
e8b8d940d5 benchmark: fix typo in inspect-proxy
PR-URL: https://github.com/nodejs/node/pull/14237
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-07-14 14:21:24 -07:00
Bartosz Sosnowski
ca86aa5323 benchmark: remove forced optimization from util
This removes all instances of %OptimizeFunctionOnNextCall from util
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:05 +01:00