GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — util: improve util inspect performance by BridgeAR · Pull Request #22503 · nodejs/node

util: improve util inspect performance #22503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
BridgeAR wants to merge 3 commits into nodejs:master from BridgeAR:improve-util-perf

Uh oh!

There was an error while loading. Please reload this page.

Closed

util: improve util inspect performance #22503

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
3 commits
Select commit Hold shift + click to select a range
c6d9a4d
util: remove TODO
BridgeAR Aug 24, 2018
5f7d097
benchmark: refactor util benchmarks
BridgeAR Aug 13, 2018
2b1c2a4
util: improve inspect performance
BridgeAR Aug 12, 2018
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

2 changes: 1 addition & 1 deletion 2 benchmark/util/format.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const inputs = {
};

const bench = common.createBenchmark(main, {
n: [4e6],
n: [1e5],
type: Object.keys(inputs)
});

Expand Down
4 changes: 2 additions & 2 deletions 4 benchmark/util/inspect-array.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const common = require('../common');
const util = require('util');

const bench = common.createBenchmark(main, {
n: [1e3],
len: [1e5],
n: [5e2],
len: [1e2, 1e5],
type: [
'denseArray',
'sparseArray',
Expand Down
2 changes: 1 addition & 1 deletion 2 benchmark/util/inspect-proxy.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const util = require('util');
const common = require('../common.js');

const bench = common.createBenchmark(main, { n: [1e6] });
const bench = common.createBenchmark(main, { n: [2e4] });

function main({ n }) {
const proxyA = new Proxy({}, { get: () => {} });
Expand Down
4 changes: 2 additions & 2 deletions 4 benchmark/util/inspect.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const opts = {
none: undefined
};
const bench = common.createBenchmark(main, {
n: [2e6],
n: [2e4],
method: [
'Object',
'Object_empty',
Expand Down Expand Up @@ -81,7 +81,7 @@ function main({ method, n, option }) {
benchmark(n, new Error('error'), options);
break;
case 'Array':
benchmark(n, Array(20).fill().map((_, i) => i), options);
benchmark(n, Array(50).fill().map((_, i) => i), options);
break;
case 'TypedArray':
obj = new Uint8Array(Array(50).fill().map((_, i) => i));
Expand Down
29 changes: 9 additions & 20 deletions 29 benchmark/util/normalize-encoding.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,23 @@ const assert = require('assert');

const groupedInputs = {
group_common: ['undefined', 'utf8', 'utf-8', 'base64',
'binary', 'latin1', 'ucs-2'],
group_upper: ['UTF-8', 'UTF8', 'UCS2', 'UTF-16LE',
'UTF16LE', 'BASE64', 'UCS-2'],
group_uncommon: ['foo', '1', 'false', 'undefined', '[]', '{}'],
'binary', 'latin1', 'ucs2'],
group_upper: ['UTF-8', 'UTF8', 'UCS2',
'UTF16LE', 'BASE64', 'UCS2'],
group_uncommon: ['foo'],
group_misc: ['', 'utf16le', 'hex', 'HEX', 'BINARY']
};

const inputs = [
'',
'utf8', 'utf-8', 'UTF-8',
'UTF8', 'Utf8', 'uTf-8', 'utF-8',
'ucs2', 'UCS2', 'UcS2',
'ucs-2', 'UCS-2', 'UcS-2',
'utf16le', 'utf-16le', 'UTF-16LE', 'UTF16LE',
'', 'utf8', 'utf-8', 'UTF-8', 'UTF8', 'Utf8',
'ucs2', 'UCS2', 'utf16le', 'UTF16LE',
'binary', 'BINARY', 'latin1', 'base64', 'BASE64',
'hex', 'HEX', 'foo', '1', 'false', 'undefined', '[]', '{}'];
'hex', 'HEX', 'foo', 'undefined'
];

const bench = common.createBenchmark(main, {
input: inputs.concat(Object.keys(groupedInputs)),
n: [1e7]
n: [1e5]
}, {
flags: '--expose-internals'
});
Expand All @@ -39,16 +36,8 @@ function getInput(input) {
return groupedInputs.group_uncommon;
case 'group_misc':
return groupedInputs.group_misc;
case '1':
return [1];
case 'false':
return [false];
case 'undefined':
return [undefined];
case '[]':
return [[]];
case '{}':
return [{}];
default:
return [input];
}
Expand Down
2 changes: 1 addition & 1 deletion 2 benchmark/util/priority-queue.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const common = require('../common');

const bench = common.createBenchmark(main, {
n: [1e6]
n: [1e5]
}, { flags: ['--expose-internals'] });

function main({ n, type }) {
Expand Down
2 changes: 1 addition & 1 deletion 2 benchmark/util/splice-one.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const common = require('../common');

const bench = common.createBenchmark(main, {
n: [1e7],
n: [1e5],
pos: ['start', 'middle', 'end'],
size: [10, 100, 500],
}, { flags: ['--expose-internals'] });
Expand Down
2 changes: 1 addition & 1 deletion 2 benchmark/util/type-check.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const bench = common.createBenchmark(main, {
type: Object.keys(args),
version: ['native', 'js'],
argument: ['true', 'false-primitive', 'false-object'],
n: [5e6]
n: [1e5]
}, {
flags: ['--expose-internals']
});
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.