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,assert: improve comparison performance by BridgeAR · Pull Request #22197 · nodejs/node

Conversation

@BridgeAR

@BridgeAR BridgeAR commented Aug 8, 2018 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

This significantly improves the performance of util.isDeepStrictEqual and assert.deepStrictEqual.

Update:
I removed a lot of the original optimization. This is now condensed to the new API usage that allows to skip indices. This API is useful for all (typed) arrays. Depending on the input it is a huge performance boost.

These performance improvements are on top of the ones in #22258.

Benchmark
 assert/deepequal-buffer.js method='deepEqual' strict=1 len=1000 n=20000                                                        ***   1510.77 %      ±62.77%  ±83.85% ±109.81%
 assert/deepequal-buffer.js method='deepEqual' strict=1 len=100 n=20000                                                         ***    186.07 %       ±9.69%  ±12.92%  ±16.86%
 assert/deepequal-buffer.js method='notDeepEqual' strict=1 len=1000 n=20000                                                              5.11 %       ±6.11%   ±8.10%  ±10.47%
 assert/deepequal-buffer.js method='notDeepEqual' strict=1 len=100 n=20000                                                               4.98 %       ±7.53%   ±9.98%  ±12.91%
 assert/deepequal-map.js method='deepEqual_mixed' strict=1 len=500 n=500                                                        ***     10.07 %       ±2.03%   ±2.69%   ±3.47%
 assert/deepequal-map.js method='deepEqual_objectOnly' strict=1 len=500 n=500                                                   ***     12.10 %       ±3.54%   ±4.72%   ±6.16%
 assert/deepequal-map.js method='deepEqual_primitiveOnly' strict=1 len=500 n=500                                                        -1.33 %       ±4.69%   ±6.21%   ±8.03%
 assert/deepequal-map.js method='notDeepEqual_mixed' strict=1 len=500 n=500                                                             -1.70 %       ±5.68%   ±7.53%   ±9.75%
 assert/deepequal-map.js method='notDeepEqual_objectOnly' strict=1 len=500 n=500                                                ***     12.22 %       ±2.23%   ±2.96%   ±3.83%
 assert/deepequal-map.js method='notDeepEqual_primitiveOnly' strict=1 len=500 n=500                                                      0.31 %       ±4.13%   ±5.47%   ±7.07%
 assert/deepequal-object.js method='deepEqual' strict=1 size=1000 n=5000                                                                -2.98 %       ±4.03%   ±5.35%   ±6.91%
 assert/deepequal-object.js method='deepEqual' strict=1 size=100 n=5000                                                                 -0.32 %       ±5.36%   ±7.11%   ±9.19%
 assert/deepequal-object.js method='deepEqual' strict=1 size=50000 n=5000                                                       ***     10.37 %       ±0.84%   ±1.11%   ±1.43%
 assert/deepequal-object.js method='notDeepEqual' strict=1 size=1000 n=5000                                                     ***     27.00 %       ±7.68%  ±10.18%  ±13.16%
 assert/deepequal-object.js method='notDeepEqual' strict=1 size=100 n=5000                                                       **     10.18 %       ±6.42%   ±8.51%  ±11.01%
 assert/deepequal-object.js method='notDeepEqual' strict=1 size=50000 n=5000                                                    ***    574.60 %      ±12.70%  ±16.96%  ±22.20%
 assert/deepequal-prims-and-objs-big-array-set.js method='deepEqual_Array' strict=1 len=20000 n=25 primitive='array'            ***    217.97 %      ±10.84%  ±14.45%  ±18.86%
 assert/deepequal-prims-and-objs-big-array-set.js method='deepEqual_Array' strict=1 len=20000 n=25 primitive='number'           ***    225.33 %      ±14.02%  ±18.68%  ±24.36%
 assert/deepequal-prims-and-objs-big-array-set.js method='deepEqual_Array' strict=1 len=20000 n=25 primitive='object'           ***    210.40 %       ±7.74%  ±10.28%  ±13.32%
 assert/deepequal-prims-and-objs-big-array-set.js method='deepEqual_Array' strict=1 len=20000 n=25 primitive='string'           ***    210.77 %      ±14.55%  ±19.39%  ±25.30%
 assert/deepequal-prims-and-objs-big-array-set.js method='deepEqual_Set' strict=1 len=20000 n=25 primitive='array'                       3.58 %       ±5.43%   ±7.19%   ±9.30%
 assert/deepequal-prims-and-objs-big-array-set.js method='deepEqual_Set' strict=1 len=20000 n=25 primitive='number'                     -1.19 %       ±6.23%   ±8.26%  ±10.68%
 assert/deepequal-prims-and-objs-big-array-set.js method='deepEqual_Set' strict=1 len=20000 n=25 primitive='object'                      0.43 %       ±5.42%   ±7.18%   ±9.28%
 assert/deepequal-prims-and-objs-big-array-set.js method='deepEqual_Set' strict=1 len=20000 n=25 primitive='string'                     -0.61 %       ±5.86%   ±7.76%  ±10.04%
 assert/deepequal-prims-and-objs-big-array-set.js method='notDeepEqual_Array' strict=1 len=20000 n=25 primitive='array'         ***    226.74 %      ±12.90%  ±17.19%  ±22.41%
 assert/deepequal-prims-and-objs-big-array-set.js method='notDeepEqual_Array' strict=1 len=20000 n=25 primitive='number'        ***    248.77 %      ±15.11%  ±20.15%  ±26.31%
 assert/deepequal-prims-and-objs-big-array-set.js method='notDeepEqual_Array' strict=1 len=20000 n=25 primitive='object'        ***    225.71 %      ±11.54%  ±15.36%  ±20.02%
 assert/deepequal-prims-and-objs-big-array-set.js method='notDeepEqual_Array' strict=1 len=20000 n=25 primitive='string'        ***    219.05 %      ±14.17%  ±18.89%  ±24.65%
 assert/deepequal-prims-and-objs-big-array-set.js method='notDeepEqual_Set' strict=1 len=20000 n=25 primitive='array'                    4.85 %       ±8.10%  ±10.75%  ±13.94%
 assert/deepequal-prims-and-objs-big-array-set.js method='notDeepEqual_Set' strict=1 len=20000 n=25 primitive='number'            *      8.82 %       ±6.70%   ±8.88%  ±11.48%
 assert/deepequal-prims-and-objs-big-array-set.js method='notDeepEqual_Set' strict=1 len=20000 n=25 primitive='object'                   3.88 %       ±6.65%   ±8.82%  ±11.41%
 assert/deepequal-prims-and-objs-big-array-set.js method='notDeepEqual_Set' strict=1 len=20000 n=25 primitive='string'                  -1.03 %       ±5.57%   ±7.40%   ±9.62%
 assert/deepequal-prims-and-objs-big-loop.js method='deepEqual' strict=1 n=20000 primitive='array'                                *      5.79 %       ±4.68%   ±6.20%   ±8.02%
 assert/deepequal-prims-and-objs-big-loop.js method='deepEqual' strict=1 n=20000 primitive='number'                                      3.38 %       ±4.70%   ±6.23%   ±8.06%
 assert/deepequal-prims-and-objs-big-loop.js method='deepEqual' strict=1 n=20000 primitive='object'                              **      7.03 %       ±4.76%   ±6.31%   ±8.16%
 assert/deepequal-prims-and-objs-big-loop.js method='deepEqual' strict=1 n=20000 primitive='string'                                      2.62 %       ±4.60%   ±6.10%   ±7.89%
 assert/deepequal-prims-and-objs-big-loop.js method='notDeepEqual' strict=1 n=20000 primitive='array'                           ***     10.33 %       ±5.99%   ±7.95%  ±10.32%
 assert/deepequal-prims-and-objs-big-loop.js method='notDeepEqual' strict=1 n=20000 primitive='number'                           **      8.16 %       ±4.97%   ±6.59%   ±8.52%
 assert/deepequal-prims-and-objs-big-loop.js method='notDeepEqual' strict=1 n=20000 primitive='object'                          ***      8.89 %       ±5.18%   ±6.87%   ±8.88%
 assert/deepequal-prims-and-objs-big-loop.js method='notDeepEqual' strict=1 n=20000 primitive='string'                           **      9.07 %       ±6.11%   ±8.09%  ±10.47%
 assert/deepequal-set.js method='deepEqual_mixed' strict=1 len=500 n=500                                                        ***     13.06 %       ±1.94%   ±2.56%   ±3.32%
 assert/deepequal-set.js method='deepEqual_objectOnly' strict=1 len=500 n=500                                                   ***     11.46 %       ±1.57%   ±2.09%   ±2.71%
 assert/deepequal-set.js method='deepEqual_primitiveOnly' strict=1 len=500 n=500                                                        -3.53 %       ±4.77%   ±6.31%   ±8.16%
 assert/deepequal-set.js method='notDeepEqual_mixed' strict=1 len=500 n=500                                                              2.25 %       ±4.51%   ±6.00%   ±7.79%
 assert/deepequal-set.js method='notDeepEqual_objectOnly' strict=1 len=500 n=500                                                ***     10.32 %       ±2.12%   ±2.81%   ±3.64%
 assert/deepequal-set.js method='notDeepEqual_primitiveOnly' strict=1 len=500 n=500                                                     -0.92 %       ±3.52%   ±4.67%   ±6.03%
 assert/deepequal-typedarrays.js len=100 method='deepEqual' strict=1 n=500 type='Float32Array'                                  ***     99.81 %      ±11.33%  ±15.09%  ±19.66%
 assert/deepequal-typedarrays.js len=100 method='deepEqual' strict=1 n=500 type='Float64Array'                                  ***     95.37 %       ±7.22%   ±9.59%  ±12.44%
 assert/deepequal-typedarrays.js len=100 method='deepEqual' strict=1 n=500 type='Int8Array'                                     ***    103.86 %      ±11.88%  ±15.75%  ±20.39%
 assert/deepequal-typedarrays.js len=100 method='deepEqual' strict=1 n=500 type='Uint8Array'                                    ***     99.22 %      ±11.20%  ±14.92%  ±19.44%
 assert/deepequal-typedarrays.js len=100 method='deepEqual' strict=1 n=500 type='Uint8ClampedArray'                             ***     92.33 %      ±10.14%  ±13.47%  ±17.50%
 assert/deepequal-typedarrays.js len=100 method='notDeepEqual' strict=1 n=500 type='Float32Array'                                 *      6.62 %       ±6.57%   ±8.71%  ±11.27%
 assert/deepequal-typedarrays.js len=100 method='notDeepEqual' strict=1 n=500 type='Float64Array'                                        5.79 %       ±6.69%   ±8.87%  ±11.47%
 assert/deepequal-typedarrays.js len=100 method='notDeepEqual' strict=1 n=500 type='Int8Array'                                   **     13.83 %       ±8.80%  ±11.72%  ±15.26%
 assert/deepequal-typedarrays.js len=100 method='notDeepEqual' strict=1 n=500 type='Uint8Array'                                          2.87 %       ±5.09%   ±6.75%   ±8.73%
 assert/deepequal-typedarrays.js len=100 method='notDeepEqual' strict=1 n=500 type='Uint8ClampedArray'                                   0.70 %       ±5.73%   ±7.60%   ±9.82%
 assert/deepequal-typedarrays.js len=5000 method='deepEqual' strict=1 n=500 type='Float32Array'                                 ***   2335.33 %      ±79.73% ±106.50% ±139.47%
 assert/deepequal-typedarrays.js len=5000 method='deepEqual' strict=1 n=500 type='Float64Array'                                 ***   2033.88 %     ±115.98% ±154.94% ±202.90%
 assert/deepequal-typedarrays.js len=5000 method='deepEqual' strict=1 n=500 type='Int8Array'                                    ***   2869.75 %     ±144.70% ±193.30% ±253.14%
 assert/deepequal-typedarrays.js len=5000 method='deepEqual' strict=1 n=500 type='Uint8Array'                                   ***   2840.20 %     ±147.94% ±197.63% ±258.81%
 assert/deepequal-typedarrays.js len=5000 method='deepEqual' strict=1 n=500 type='Uint8ClampedArray'                            ***   2824.27 %     ±131.85% ±176.13% ±230.65%
 assert/deepequal-typedarrays.js len=5000 method='notDeepEqual' strict=1 n=500 type='Float32Array'                                *      8.54 %       ±6.78%   ±9.01%  ±11.72%
 assert/deepequal-typedarrays.js len=5000 method='notDeepEqual' strict=1 n=500 type='Float64Array'                               **      9.54 %       ±6.63%   ±8.81%  ±11.45%
 assert/deepequal-typedarrays.js len=5000 method='notDeepEqual' strict=1 n=500 type='Int8Array'                                          2.08 %       ±5.25%   ±6.96%   ±9.00%
 assert/deepequal-typedarrays.js len=5000 method='notDeepEqual' strict=1 n=500 type='Uint8Array'                                         1.98 %       ±6.92%   ±9.17%  ±11.85%
 assert/deepequal-typedarrays.js len=5000 method='notDeepEqual' strict=1 n=500 type='Uint8ClampedArray'                           *      9.76 %       ±9.12%  ±12.13%  ±15.78%
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Sorry, something went wrong.

Uh oh!

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

All reactions
@nodejs-github-bot

nodejs-github-bot commented Aug 8, 2018

Copy link
Copy Markdown
Collaborator

@BridgeAR build started: https://ci.nodejs.org/blue/organizations/jenkins/node-test-pull-request-lite-pipeline/detail/node-test-pull-request-lite-pipeline/464/pipeline

All reactions

Sorry, something went wrong.

Uh oh!

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

@nodejs-github-bot nodejs-github-bot added the lib / src Issues and PRs involving general changes in the lib/ or src/ directories. label Aug 8, 2018
@BridgeAR BridgeAR mentioned this pull request Aug 8, 2018
util, assert: improve array comparison performance #22111
Closed
4 tasks done
@mscdex

mscdex commented Aug 8, 2018

Copy link
Copy Markdown
Contributor

Perhaps the V8 patch should be done in a separate PR for easier management? Additionally, the v8_embedder_string in common.gypi needs to be updated whenever a V8 patch is applied.

benjamingr reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

benjamingr
benjamingr reviewed Aug 8, 2018
View reviewed changes

@benjamingr benjamingr left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a ton of stuff here:

  • There's a refactoring of the buffer benchmarks
  • There's a change to make comparisons.js safe to tampering of primitives
  • There's a v8 patch and tests for it
  • There's a complete rewrite of strictDeepEqual

I don't understand why it's all in one PR - it makes it hard to review.

In general terms I'm very +1 on the changes and it looks like good code - it's just hard to review right now.

Sorry, something went wrong.

Uh oh!

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

All reactions
@BridgeAR

BridgeAR commented Aug 9, 2018

Copy link
Copy Markdown
Member Author

@mscdex thanks, I forgot about that. It is now fixed.

I have all the things together in one PR because they mainly rely on each other and quite a few would cause conflicts otherwise. Since you both would rather have the PR split up, I'll do that tough.

benjamingr reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@BridgeAR BridgeAR added the blocked PRs that are blocked by other issues or PRs. label Aug 9, 2018
@BridgeAR

BridgeAR commented Aug 9, 2018

Copy link
Copy Markdown
Member Author

I moved some parts and I'll wait until those land and then rebase this PR.

All reactions

Sorry, something went wrong.

Uh oh!

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

@BridgeAR BridgeAR mentioned this pull request Aug 11, 2018
util,assert: improve comparison performance #22258
Closed
4 tasks done
@BridgeAR
BridgeAR force-pushed the improve-comparison-further branch from dba237a to 546275b Compare August 15, 2018 17:10
@BridgeAR BridgeAR added assert Issues and PRs related to the assert subsystem. util Issues and PRs related to the built-in util module. and removed blocked PRs that are blocked by other issues or PRs. labels Aug 15, 2018
@BridgeAR

BridgeAR commented Aug 15, 2018

Copy link
Copy Markdown
Member Author

CI https://ci.nodejs.org/job/node-test-pull-request/16467/
Benchmark https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/225/

All reactions

Sorry, something went wrong.

Uh oh!

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

@BridgeAR BridgeAR added the performance Issues and PRs related to the performance of Node.js. label Aug 15, 2018
@BridgeAR

BridgeAR commented Aug 15, 2018

Copy link
Copy Markdown
Member Author

Here the benchmark results for strict mode:

These performance improvements are on top of the ones in #22258.

Benchmark
 assert/deepequal-buffer.js method='deepEqual' strict=1 len=1000 n=20000                                                        ***   1510.77 %      ±62.77%  ±83.85% ±109.81%
 assert/deepequal-buffer.js method='deepEqual' strict=1 len=100 n=20000                                                         ***    186.07 %       ±9.69%  ±12.92%  ±16.86%
 assert/deepequal-buffer.js method='notDeepEqual' strict=1 len=1000 n=20000                                                              5.11 %       ±6.11%   ±8.10%  ±10.47%
 assert/deepequal-buffer.js method='notDeepEqual' strict=1 len=100 n=20000                                                               4.98 %       ±7.53%   ±9.98%  ±12.91%
 assert/deepequal-map.js method='deepEqual_mixed' strict=1 len=500 n=500                                                        ***     10.07 %       ±2.03%   ±2.69%   ±3.47%
 assert/deepequal-map.js method='deepEqual_objectOnly' strict=1 len=500 n=500                                                   ***     12.10 %       ±3.54%   ±4.72%   ±6.16%
 assert/deepequal-map.js method='deepEqual_primitiveOnly' strict=1 len=500 n=500                                                        -1.33 %       ±4.69%   ±6.21%   ±8.03%
 assert/deepequal-map.js method='notDeepEqual_mixed' strict=1 len=500 n=500                                                             -1.70 %       ±5.68%   ±7.53%   ±9.75%
 assert/deepequal-map.js method='notDeepEqual_objectOnly' strict=1 len=500 n=500                                                ***     12.22 %       ±2.23%   ±2.96%   ±3.83%
 assert/deepequal-map.js method='notDeepEqual_primitiveOnly' strict=1 len=500 n=500                                                      0.31 %       ±4.13%   ±5.47%   ±7.07%
 assert/deepequal-object.js method='deepEqual' strict=1 size=1000 n=5000                                                                -2.98 %       ±4.03%   ±5.35%   ±6.91%
 assert/deepequal-object.js method='deepEqual' strict=1 size=100 n=5000                                                                 -0.32 %       ±5.36%   ±7.11%   ±9.19%
 assert/deepequal-object.js method='deepEqual' strict=1 size=50000 n=5000                                                       ***     10.37 %       ±0.84%   ±1.11%   ±1.43%
 assert/deepequal-object.js method='notDeepEqual' strict=1 size=1000 n=5000                                                     ***     27.00 %       ±7.68%  ±10.18%  ±13.16%
 assert/deepequal-object.js method='notDeepEqual' strict=1 size=100 n=5000                                                       **     10.18 %       ±6.42%   ±8.51%  ±11.01%
 assert/deepequal-object.js method='notDeepEqual' strict=1 size=50000 n=5000                                                    ***    574.60 %      ±12.70%  ±16.96%  ±22.20%
 assert/deepequal-prims-and-objs-big-array-set.js method='deepEqual_Array' strict=1 len=20000 n=25 primitive='array'            ***    217.97 %      ±10.84%  ±14.45%  ±18.86%
 assert/deepequal-prims-and-objs-big-array-set.js method='deepEqual_Array' strict=1 len=20000 n=25 primitive='number'           ***    225.33 %      ±14.02%  ±18.68%  ±24.36%
 assert/deepequal-prims-and-objs-big-array-set.js method='deepEqual_Array' strict=1 len=20000 n=25 primitive='object'           ***    210.40 %       ±7.74%  ±10.28%  ±13.32%
 assert/deepequal-prims-and-objs-big-array-set.js method='deepEqual_Array' strict=1 len=20000 n=25 primitive='string'           ***    210.77 %      ±14.55%  ±19.39%  ±25.30%
 assert/deepequal-prims-and-objs-big-array-set.js method='deepEqual_Set' strict=1 len=20000 n=25 primitive='array'                       3.58 %       ±5.43%   ±7.19%   ±9.30%
 assert/deepequal-prims-and-objs-big-array-set.js method='deepEqual_Set' strict=1 len=20000 n=25 primitive='number'                     -1.19 %       ±6.23%   ±8.26%  ±10.68%
 assert/deepequal-prims-and-objs-big-array-set.js method='deepEqual_Set' strict=1 len=20000 n=25 primitive='object'                      0.43 %       ±5.42%   ±7.18%   ±9.28%
 assert/deepequal-prims-and-objs-big-array-set.js method='deepEqual_Set' strict=1 len=20000 n=25 primitive='string'                     -0.61 %       ±5.86%   ±7.76%  ±10.04%
 assert/deepequal-prims-and-objs-big-array-set.js method='notDeepEqual_Array' strict=1 len=20000 n=25 primitive='array'         ***    226.74 %      ±12.90%  ±17.19%  ±22.41%
 assert/deepequal-prims-and-objs-big-array-set.js method='notDeepEqual_Array' strict=1 len=20000 n=25 primitive='number'        ***    248.77 %      ±15.11%  ±20.15%  ±26.31%
 assert/deepequal-prims-and-objs-big-array-set.js method='notDeepEqual_Array' strict=1 len=20000 n=25 primitive='object'        ***    225.71 %      ±11.54%  ±15.36%  ±20.02%
 assert/deepequal-prims-and-objs-big-array-set.js method='notDeepEqual_Array' strict=1 len=20000 n=25 primitive='string'        ***    219.05 %      ±14.17%  ±18.89%  ±24.65%
 assert/deepequal-prims-and-objs-big-array-set.js method='notDeepEqual_Set' strict=1 len=20000 n=25 primitive='array'                    4.85 %       ±8.10%  ±10.75%  ±13.94%
 assert/deepequal-prims-and-objs-big-array-set.js method='notDeepEqual_Set' strict=1 len=20000 n=25 primitive='number'            *      8.82 %       ±6.70%   ±8.88%  ±11.48%
 assert/deepequal-prims-and-objs-big-array-set.js method='notDeepEqual_Set' strict=1 len=20000 n=25 primitive='object'                   3.88 %       ±6.65%   ±8.82%  ±11.41%
 assert/deepequal-prims-and-objs-big-array-set.js method='notDeepEqual_Set' strict=1 len=20000 n=25 primitive='string'                  -1.03 %       ±5.57%   ±7.40%   ±9.62%
 assert/deepequal-prims-and-objs-big-loop.js method='deepEqual' strict=1 n=20000 primitive='array'                                *      5.79 %       ±4.68%   ±6.20%   ±8.02%
 assert/deepequal-prims-and-objs-big-loop.js method='deepEqual' strict=1 n=20000 primitive='number'                                      3.38 %       ±4.70%   ±6.23%   ±8.06%
 assert/deepequal-prims-and-objs-big-loop.js method='deepEqual' strict=1 n=20000 primitive='object'                              **      7.03 %       ±4.76%   ±6.31%   ±8.16%
 assert/deepequal-prims-and-objs-big-loop.js method='deepEqual' strict=1 n=20000 primitive='string'                                      2.62 %       ±4.60%   ±6.10%   ±7.89%
 assert/deepequal-prims-and-objs-big-loop.js method='notDeepEqual' strict=1 n=20000 primitive='array'                           ***     10.33 %       ±5.99%   ±7.95%  ±10.32%
 assert/deepequal-prims-and-objs-big-loop.js method='notDeepEqual' strict=1 n=20000 primitive='number'                           **      8.16 %       ±4.97%   ±6.59%   ±8.52%
 assert/deepequal-prims-and-objs-big-loop.js method='notDeepEqual' strict=1 n=20000 primitive='object'                          ***      8.89 %       ±5.18%   ±6.87%   ±8.88%
 assert/deepequal-prims-and-objs-big-loop.js method='notDeepEqual' strict=1 n=20000 primitive='string'                           **      9.07 %       ±6.11%   ±8.09%  ±10.47%
 assert/deepequal-set.js method='deepEqual_mixed' strict=1 len=500 n=500                                                        ***     13.06 %       ±1.94%   ±2.56%   ±3.32%
 assert/deepequal-set.js method='deepEqual_objectOnly' strict=1 len=500 n=500                                                   ***     11.46 %       ±1.57%   ±2.09%   ±2.71%
 assert/deepequal-set.js method='deepEqual_primitiveOnly' strict=1 len=500 n=500                                                        -3.53 %       ±4.77%   ±6.31%   ±8.16%
 assert/deepequal-set.js method='notDeepEqual_mixed' strict=1 len=500 n=500                                                              2.25 %       ±4.51%   ±6.00%   ±7.79%
 assert/deepequal-set.js method='notDeepEqual_objectOnly' strict=1 len=500 n=500                                                ***     10.32 %       ±2.12%   ±2.81%   ±3.64%
 assert/deepequal-set.js method='notDeepEqual_primitiveOnly' strict=1 len=500 n=500                                                     -0.92 %       ±3.52%   ±4.67%   ±6.03%
 assert/deepequal-typedarrays.js len=100 method='deepEqual' strict=1 n=500 type='Float32Array'                                  ***     99.81 %      ±11.33%  ±15.09%  ±19.66%
 assert/deepequal-typedarrays.js len=100 method='deepEqual' strict=1 n=500 type='Float64Array'                                  ***     95.37 %       ±7.22%   ±9.59%  ±12.44%
 assert/deepequal-typedarrays.js len=100 method='deepEqual' strict=1 n=500 type='Int8Array'                                     ***    103.86 %      ±11.88%  ±15.75%  ±20.39%
 assert/deepequal-typedarrays.js len=100 method='deepEqual' strict=1 n=500 type='Uint8Array'                                    ***     99.22 %      ±11.20%  ±14.92%  ±19.44%
 assert/deepequal-typedarrays.js len=100 method='deepEqual' strict=1 n=500 type='Uint8ClampedArray'                             ***     92.33 %      ±10.14%  ±13.47%  ±17.50%
 assert/deepequal-typedarrays.js len=100 method='notDeepEqual' strict=1 n=500 type='Float32Array'                                 *      6.62 %       ±6.57%   ±8.71%  ±11.27%
 assert/deepequal-typedarrays.js len=100 method='notDeepEqual' strict=1 n=500 type='Float64Array'                                        5.79 %       ±6.69%   ±8.87%  ±11.47%
 assert/deepequal-typedarrays.js len=100 method='notDeepEqual' strict=1 n=500 type='Int8Array'                                   **     13.83 %       ±8.80%  ±11.72%  ±15.26%
 assert/deepequal-typedarrays.js len=100 method='notDeepEqual' strict=1 n=500 type='Uint8Array'                                          2.87 %       ±5.09%   ±6.75%   ±8.73%
 assert/deepequal-typedarrays.js len=100 method='notDeepEqual' strict=1 n=500 type='Uint8ClampedArray'                                   0.70 %       ±5.73%   ±7.60%   ±9.82%
 assert/deepequal-typedarrays.js len=5000 method='deepEqual' strict=1 n=500 type='Float32Array'                                 ***   2335.33 %      ±79.73% ±106.50% ±139.47%
 assert/deepequal-typedarrays.js len=5000 method='deepEqual' strict=1 n=500 type='Float64Array'                                 ***   2033.88 %     ±115.98% ±154.94% ±202.90%
 assert/deepequal-typedarrays.js len=5000 method='deepEqual' strict=1 n=500 type='Int8Array'                                    ***   2869.75 %     ±144.70% ±193.30% ±253.14%
 assert/deepequal-typedarrays.js len=5000 method='deepEqual' strict=1 n=500 type='Uint8Array'                                   ***   2840.20 %     ±147.94% ±197.63% ±258.81%
 assert/deepequal-typedarrays.js len=5000 method='deepEqual' strict=1 n=500 type='Uint8ClampedArray'                            ***   2824.27 %     ±131.85% ±176.13% ±230.65%
 assert/deepequal-typedarrays.js len=5000 method='notDeepEqual' strict=1 n=500 type='Float32Array'                                *      8.54 %       ±6.78%   ±9.01%  ±11.72%
 assert/deepequal-typedarrays.js len=5000 method='notDeepEqual' strict=1 n=500 type='Float64Array'                               **      9.54 %       ±6.63%   ±8.81%  ±11.45%
 assert/deepequal-typedarrays.js len=5000 method='notDeepEqual' strict=1 n=500 type='Int8Array'                                          2.08 %       ±5.25%   ±6.96%   ±9.00%
 assert/deepequal-typedarrays.js len=5000 method='notDeepEqual' strict=1 n=500 type='Uint8Array'                                         1.98 %       ±6.92%   ±9.17%  ±11.85%
 assert/deepequal-typedarrays.js len=5000 method='notDeepEqual' strict=1 n=500 type='Uint8ClampedArray'                           *      9.76 %       ±9.12%  ±12.13%  ±15.78%
All reactions

Sorry, something went wrong.

Uh oh!

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

@BridgeAR
BridgeAR requested review from Trott, benjamingr, jasnell and mscdex August 15, 2018 20:51
@BridgeAR

BridgeAR commented Aug 15, 2018

Copy link
Copy Markdown
Member Author

PTAL @nodejs/util @nodejs/testing

All reactions

Sorry, something went wrong.

Uh oh!

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

@Trott

Trott commented Aug 15, 2018 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

@joyeecheung @addaleax [EDIT: Used git shortlog to get an idea of who might be most familiar with the files modified here. I can give this a review, but I'd want someone else to review the C++ part especially.]

All reactions

Sorry, something went wrong.

Uh oh!

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

@BridgeAR

BridgeAR commented Aug 15, 2018

Copy link
Copy Markdown
Member Author

New CI https://ci.nodejs.org/job/node-test-pull-request/16469/

All reactions

Sorry, something went wrong.

Uh oh!

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

@BridgeAR BridgeAR added dont-land-on-v6.x labels Aug 15, 2018
@BridgeAR
BridgeAR requested review from andrasq, apapirovski, devsnek and mcollina August 16, 2018 23:49
@BridgeAR
BridgeAR requested a review from ryzokuken August 16, 2018 23:49
@BridgeAR

BridgeAR commented Aug 17, 2018

Copy link
Copy Markdown
Member Author

Rerun the CI https://ci.nodejs.org/job/node-test-commit/20612/ ✔️

All reactions

Sorry, something went wrong.

Uh oh!

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

@BridgeAR

BridgeAR commented Aug 17, 2018

Copy link
Copy Markdown
Member Author

It would be great to get a review.

I have a follow up optimization for util inspect that requires the same c++ function and I wait for opening the PR until this lands.

All reactions

Sorry, something went wrong.

Uh oh!

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

@benjamingr

benjamingr commented Aug 17, 2018

Copy link
Copy Markdown
Member

I'm sorry, I read the code and it looks good to me but I don't understand it well enough to LGTM and would prefer it if someone who has more experience with the API review it.

If you don't get a review in 48 hours ping me and I'll go through the V8 changes very carefully and review.

Also, pinging benedikt or maya for when they're back might be a good idea @bmeurer @MayaLekova

All reactions

Sorry, something went wrong.

Uh oh!

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

ryzokuken
ryzokuken approved these changes Aug 17, 2018
View reviewed changes

@ryzokuken ryzokuken left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a few minor doubts.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread src/node_util.cc Outdated

@ryzokuken ryzokuken Aug 17, 2018

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't see if we have a check for this in-place. Will we crash if this fails? That said, does it ever really realistically fail?

Sorry, something went wrong.

Uh oh!

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

addaleax reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@BridgeAR BridgeAR Aug 17, 2018

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it would crash. But this API is only used internally and not exposed. That's why I did not add a safeguard against wrong input values.

Sorry, something went wrong.

Uh oh!

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

All reactions

@BridgeAR BridgeAR Aug 19, 2018

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a check for that as well.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread src/node_util.cc Outdated

@ryzokuken ryzokuken Aug 17, 2018

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, does this ever fail? Instead, you could try something like

if(!object->GetPropertyNames(...).ToLocal(&properties)) return;

Sorry, something went wrong.

Uh oh!

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

addaleax reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@BridgeAR BridgeAR Aug 17, 2018

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not aware about this. I use it as it's done in the V8 tests. @nodejs/v8 do we have to add a guard against this?

Sorry, something went wrong.

Uh oh!

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

All reactions

@ryzokuken ryzokuken Aug 17, 2018

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you do, yes. The whole point of ToLocalChecked is that you must've checked the value earlier. You could either add a CHECK statement before this one, in which case it'll still crash (probably in a much better manner, but crash nonetheless) or use ToLocal as I did above.

Sorry, something went wrong.

Uh oh!

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

All reactions

@joyeecheung joyeecheung Aug 17, 2018 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the original behavior of Object.keys is to throw if the keys cannot be collected, it makes more sense to return if the maybe is empty and throw in the JS land. (I guess this should fail if you throw an error in the enumerate proxy handler, though it is deprecated? EDIT: nope, it's not in V8 anymore)

Sorry, something went wrong.

Uh oh!

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

All reactions

@ryzokuken ryzokuken Aug 17, 2018

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. Returning (throwing) if the MaybeLocal is empty seems to be the most logical thing to do. In V8, one would use the macro ASSIGN_RETURN_FAILURE_ON_EXCEPTION which is essentially:

if (!call(...)->ToLocal(&result) {
  DCHECK(isolate->has_pending_exception());
  return;
}

Sorry, something went wrong.

Uh oh!

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

All reactions

@addaleax addaleax Aug 19, 2018

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please use @ryzokuken’s suggestion here, I think this could otherwise fail when inspecting Proxies with an ownKeys handler. A CHECK() would have the same behaviour as ToLocalChecked(), so that’s not enough either.

Sorry, something went wrong.

Uh oh!

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

All reactions

@BridgeAR BridgeAR Aug 19, 2018

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! I learned something through your comments 👍. It is now handled as suggested.

Sorry, something went wrong.

Uh oh!

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

All reactions
@BridgeAR
BridgeAR requested a review from addaleax August 17, 2018 16:23
@joyeecheung joyeecheung mentioned this pull request Aug 17, 2018
CI Failures: 20180817 nodejs/reliability#14
Closed
addaleax
addaleax reviewed Aug 19, 2018
View reviewed changes

@addaleax addaleax left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once @ryzokuken’s comment is addressed

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread src/node_util.cc Outdated

@addaleax addaleax Aug 19, 2018

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please use @ryzokuken’s suggestion here, I think this could otherwise fail when inspecting Proxies with an ownKeys handler. A CHECK() would have the same behaviour as ToLocalChecked(), so that’s not enough either.

Sorry, something went wrong.

Uh oh!

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

All reactions
@BridgeAR

BridgeAR commented Aug 19, 2018

Copy link
Copy Markdown
Member Author

CI https://ci.nodejs.org/job/node-test-pull-request/16568/

All reactions

Sorry, something went wrong.

Uh oh!

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

@Trott

Trott commented Aug 19, 2018

Copy link
Copy Markdown
Member

@BridgeAR This needs to be rebased against master due to the recent CI hiccup. (Also, it looks like @addaleax signed off on this but did not use the green checkmark, so maybe add their Reviewed-By: manually if ncu doesn't pick it up and if you're feeling up to it!)

All reactions

Sorry, something went wrong.

Uh oh!

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

BridgeAR added 2 commits August 19, 2018 20:30
@BridgeAR
util,assert: improve performance
6e7cf50
This significantly improves regular and typed array performance by
not checking the indices keys anymore. This can be done with a V8
API that allows to only retrieve the non indices property keys.
@BridgeAR
fixup: handle c++ error properly
3c83e47
@BridgeAR
BridgeAR force-pushed the improve-comparison-further branch from 32520f6 to 3c83e47 Compare August 19, 2018 18:31
@BridgeAR

BridgeAR commented Aug 19, 2018

Copy link
Copy Markdown
Member Author

Rebased. I squashed the reviewed part and kept the other part.

CI https://ci.nodejs.org/job/node-test-pull-request/16580/

All reactions

Sorry, something went wrong.

Uh oh!

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

@targos targos removed the dont-land-on-v9.x label Aug 19, 2018
addaleax
addaleax approved these changes Aug 19, 2018
View reviewed changes

@addaleax addaleax left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread lib/internal/util/comparisons.js Resolved

Uh oh!

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

BridgeAR added a commit to BridgeAR/node that referenced this pull request Aug 20, 2018
@BridgeAR
util,assert: improve performance
3479b1c
This significantly improves regular and typed array performance by
not checking the indices keys anymore. This can be done with a V8
API that allows to only retrieve the non indices property keys.

PR-URL: nodejs#22197
Reviewed-By: Ujjwal Sharma <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
@BridgeAR

BridgeAR commented Aug 20, 2018

Copy link
Copy Markdown
Member Author

Thanks for the reviews!

Landed in 3479b1c 🎉

All reactions

Sorry, something went wrong.

Uh oh!

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

@BridgeAR BridgeAR closed this Aug 20, 2018
This was referenced Aug 20, 2018
test-digitalocean-fedora27-x64-1 keeps timing out nodejs/build#1463
Closed
CI failures: 20180820 nodejs/reliability#15
Closed
bmeurer
bmeurer reviewed Aug 20, 2018
View reviewed changes

@bmeurer bmeurer left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sorry, something went wrong.

Uh oh!

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

All reactions
targos pushed a commit that referenced this pull request Aug 21, 2018
@BridgeAR @targos
util,assert: improve performance
ca44001
This significantly improves regular and typed array performance by
not checking the indices keys anymore. This can be done with a V8
API that allows to only retrieve the non indices property keys.

PR-URL: #22197
Reviewed-By: Ujjwal Sharma <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
targos pushed a commit that referenced this pull request Sep 3, 2018
@BridgeAR @targos
util,assert: improve performance
2b1cb3b
This significantly improves regular and typed array performance by
not checking the indices keys anymore. This can be done with a V8
API that allows to only retrieve the non indices property keys.

PR-URL: #22197
Reviewed-By: Ujjwal Sharma <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
@targos targos mentioned this pull request Sep 5, 2018
Release proposal: v10.10.0 #22716
Merged
This was referenced Sep 6, 2018
2018-09-06 Version 10.10.0 (Current) @targos beevelop/docker-android-nodejs#236
Closed
2018-09-06 Version 10.10.0 (Current) @targos beevelop/docker-nodejs#221
Closed
@BridgeAR
BridgeAR deleted the improve-comparison-further branch January 20, 2020 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@joyeecheung joyeecheung joyeecheung left review comments
@addaleax addaleax addaleax approved these changes
@Trott Trott Awaiting requested review from Trott
@benjamingr benjamingr Awaiting requested review from benjamingr
@jasnell jasnell Awaiting requested review from jasnell
@mscdex mscdex Awaiting requested review from mscdex
@andrasq andrasq Awaiting requested review from andrasq
@apapirovski apapirovski Awaiting requested review from apapirovski
@devsnek devsnek Awaiting requested review from devsnek
@mcollina mcollina Awaiting requested review from mcollina
+2 more reviewers
@bmeurer bmeurer bmeurer left review comments
@ryzokuken ryzokuken ryzokuken approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

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

Assignees

No one assigned

Labels

assert Issues and PRs related to the assert subsystem. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. performance Issues and PRs related to the performance of Node.js. util Issues and PRs related to the built-in util module.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

10 participants

@BridgeAR @nodejs-github-bot @mscdex @Trott @benjamingr @bmeurer @addaleax @joyeecheung @ryzokuken @targos
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.