Skip to content
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.

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

benchmark: add benchmark for object properties #10949

Closed
wants to merge 1 commit into from

Conversation

targos
Copy link
Member

@targos targos commented Jan 22, 2017

Adds a benchmark to compare the speed of property setting/getting in
four cases:

  • Dot notation: obj.prop = value
  • Bracket notation with string: obj['prop'] = value
  • Bracket notation with string variable: obj[prop] = value
  • Bracket notation with Symbol variable: obj[sym] = value
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

benchmark

Adds a benchmark to compare the speed of property setting/getting in
four cases:
- Dot notation: `obj.prop = value`
- Bracket notation with string: `obj['prop'] = value`
- Bracket notation with string variable: `obj[prop] = value`
- Bracket notation with Symbol variable: `obj[sym] = value`
@nodejs-github-bot nodejs-github-bot added benchmark Issues and PRs related to the benchmark subsystem. lts-watch-v6.x labels Jan 22, 2017
@targos
Copy link
Member Author

targos commented Jan 22, 2017

Results with current versions:

# v8.0.0-pre
$ ./node benchmark/misc/object-property-bench.js
misc/object-property-bench.js millions=1000 method="property": 1,132.5729019905275
misc/object-property-bench.js millions=1000 method="string": 1,132.659171573988
misc/object-property-bench.js millions=1000 method="variable": 1,135.7484620810199
misc/object-property-bench.js millions=1000 method="symbol": 1,137.1793635505953

# Now using node v7.4.0 (npm v4.0.5)
$ node benchmark/misc/object-property-bench.js
misc/object-property-bench.js millions=1000 method="property": 1,136.5219151213475
misc/object-property-bench.js millions=1000 method="string": 1,136.0132317913663
misc/object-property-bench.js millions=1000 method="variable": 1,137.077082457694
misc/object-property-bench.js millions=1000 method="symbol": 1,135.8285965589414

# Now using node v6.9.4 (npm v3.10.10)
$ node benchmark/misc/object-property-bench.js
misc/object-property-bench.js millions=1000 method="property": 1,136.9333640080988
misc/object-property-bench.js millions=1000 method="string": 1,137.4697778972075
misc/object-property-bench.js millions=1000 method="variable": 1,139.3569692351732
misc/object-property-bench.js millions=1000 method="symbol": 1,144.1529516480275

# Now using node v4.7.2 (npm v2.15.11)
$ node benchmark/misc/object-property-bench.js
misc/object-property-bench.js millions=1000 method="property": 1,136.765490715278
misc/object-property-bench.js millions=1000 method="string": 1,137.4072967414688
misc/object-property-bench.js millions=1000 method="variable": 78.51823908746029
misc/object-property-bench.js millions=1000 method="symbol": 79.12821605254518

@targos
Copy link
Member Author

targos commented Jan 27, 2017

Landed in ad6e778

@targos targos closed this Jan 27, 2017
@targos targos deleted the benchmark-object-property branch January 27, 2017 12:04
targos added a commit that referenced this pull request Jan 27, 2017
Adds a benchmark to compare the speed of property setting/getting in
four cases:
- Dot notation: `obj.prop = value`
- Bracket notation with string: `obj['prop'] = value`
- Bracket notation with string variable: `obj[prop] = value`
- Bracket notation with Symbol variable: `obj[sym] = value`

PR-URL: #10949
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
evanlucas pushed a commit that referenced this pull request Jan 31, 2017
Adds a benchmark to compare the speed of property setting/getting in
four cases:
- Dot notation: `obj.prop = value`
- Bracket notation with string: `obj['prop'] = value`
- Bracket notation with string variable: `obj[prop] = value`
- Bracket notation with Symbol variable: `obj[sym] = value`

PR-URL: #10949
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@italoacasas italoacasas mentioned this pull request Jan 31, 2017
jasnell pushed a commit that referenced this pull request Mar 8, 2017
Adds a benchmark to compare the speed of property setting/getting in
four cases:
- Dot notation: `obj.prop = value`
- Bracket notation with string: `obj['prop'] = value`
- Bracket notation with string variable: `obj[prop] = value`
- Bracket notation with Symbol variable: `obj[sym] = value`

PR-URL: #10949
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
jasnell pushed a commit that referenced this pull request Mar 8, 2017
Adds a benchmark to compare the speed of property setting/getting in
four cases:
- Dot notation: `obj.prop = value`
- Bracket notation with string: `obj['prop'] = value`
- Bracket notation with string variable: `obj[prop] = value`
- Bracket notation with Symbol variable: `obj[sym] = value`

PR-URL: #10949
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request Mar 9, 2017
Adds a benchmark to compare the speed of property setting/getting in
four cases:
- Dot notation: `obj.prop = value`
- Bracket notation with string: `obj['prop'] = value`
- Bracket notation with string variable: `obj[prop] = value`
- Bracket notation with Symbol variable: `obj[sym] = value`

PR-URL: #10949
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Mar 9, 2017
MylesBorins pushed a commit that referenced this pull request Mar 9, 2017
Adds a benchmark to compare the speed of property setting/getting in
four cases:
- Dot notation: `obj.prop = value`
- Bracket notation with string: `obj['prop'] = value`
- Bracket notation with string variable: `obj[prop] = value`
- Bracket notation with Symbol variable: `obj[sym] = value`

PR-URL: #10949
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Mar 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmark Issues and PRs related to the benchmark subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants