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: obj property access benchmark #11611

Closed
wants to merge 1 commit into from

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Feb 28, 2017

Benchmark that compares the obj property access patterns being
used in core today. Specifically comparing the two patterns:

function A() {};
function B() {};
var obj = {A, B, C: 1};

and

function A() {}
function B() {}
var obj = {};
obj.A = A;
obj.B = B;
obj.C = 1;

@mscdex @nodejs/benchmarking

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

Benchmark that compares the obj property access patterns being
used in core today. Specifically comparing the two patterns:

```js
function A() {};
function B() {};
var obj = {A, B, C: 1};
```

and

```js
function A() {}
function B() {}
var obj = {};
obj.A = A;
obj.B = B;
obj.C = 1;
```
@nodejs-github-bot nodejs-github-bot added the benchmark Issues and PRs related to the benchmark subsystem. label Feb 28, 2017
@mscdex mscdex added the v8 engine Issues and PRs related to the V8 dependency. label Feb 28, 2017
@Trott
Copy link
Member

Trott commented Mar 1, 2017

Am I the only one who is not a fan of including all those ES microbenchmarks in core? And now feeling a bit of trepidation about stuff like this in the es directory, which arguably isn't even an ES benchmark?

These all might be useful benchmarks, but I wonder if they might be better in some separate benchmarking repo.

I'd prefer the benchmarks bundled with core source be restricted to tracking actual node performance of actual core code in ways it will be used by actual end users.

Good benchmark to include in core: How many simultaneous http connections can we serve?

Less good IMO: Which of these two tiny contrived fixture modules is faster?

The results of this benchmark might be valid. Or real world results might vary quite a bit depending on use case. Because we never really know about the latter, I'd prefer we stick to benchmarking our actual use cases. Also, if this is going to cause a bunch of code churn for an improvement that isn't actually measurable in real code, then it may be creating more problems than it's solving.

If this is all just me and everybody else thinks including these types of benchmarks is somewhere between harmless and awesome, I will be a team player about it. :-D

@jasnell
Copy link
Member Author

jasnell commented Mar 1, 2017

These are minimal impact (there's no harm in having them here) and they allow us to track the performance tradeoffs of code styles and language features that are actively used within core. They allow us to make better decisions about what kind of changes to land and when. I'd prefer to keep them... but then again, I'm the one that opened the PR so that part should be obvious :-)

@jasnell
Copy link
Member Author

jasnell commented Mar 15, 2017

@nodejs/benchmarking @mscdex Thoughts on this?

for (i = 0; i < n; i++) {
A();
B();
obj.C;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why have this if it's the same in both direct/indirect cases?

Copy link
Member Author

Choose a reason for hiding this comment

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

Which specifically? The obj.C bit? Basically checking any accumulative effect. It may not make sense to keep tho :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

.. by accumulative effect, I mean I want to measure the performance of all the accesses on the different module patterns.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, the obj.C is what I'm referring to.

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. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants