Skip to content

events: performance regression in event benchmarks #12657

Description

@jasnell

See: #12655 (comment)

$ ./node benchmark/compare.js --old node --new ../main/node events > ~/eventsbench
[00:10:21|% 100| 7/7 files | 60/60 runs | 1/1 configs]: Done
 james@ubuntu:~/node/node$cat ~/eventsbench | Rscript benchmark/compare.Rh
                                                     improvement confidence      p.value
 events/ee-add-remove.js n=250000                       -45.73 %        *** 8.380381e-18
 events/ee-emit-multi-args.js n=2000000                   0.70 %            2.285963e-01
 events/ee-emit.js n=2000000                              2.12 %        *** 3.829377e-05
 events/ee-listener-count-on-prototype.js n=50000000    -95.07 %        *** 1.717885e-35
 events/ee-listeners-many.js n=5000000                  -20.60 %        *** 8.616063e-14
 events/ee-listeners.js n=5000000                       -48.69 %        *** 2.759171e-60
 events/ee-once.js n=20000000                           -58.16 %        *** 3.019260e-56

I'm seeing a significant performance regression in the events benchmarks comparing master to 7.9.

/cc @mscdex @mcollina @nodejs/benchmarking

Activity

  1. TimothyGu commented on Apr 25, 2017

    @TimothyGu
    Member

    Cross posting from #12655 (comment):

    It's very probable that the regression you are seeing comes from #11930, but IMO it is more of a problem of unrealistic benchmark (see #11930 (comment) for my reasoning).

  2. added
    eventsIssues and PRs related to EventEmitter and the events module.
    performanceIssues and PRs related to the performance of Node.js.
    on Apr 25, 2017
  3. mcollina commented on May 9, 2017

    @mcollina
    SponsorMember

    I think the problem for this regression is https://bugs.chromium.org/p/v8/issues/detail?id=6376. Specifically https://github.com/nodejs/node/blob/master/lib/events.js#L378, as the regression is present in the remove benchmarks.

  4. bmeurer commented on May 9, 2017

    @bmeurer
    Member

    I'm working on the Array.prototype.shift fast-path in TurboFan.

  5. 10 remaining items

  6. Trott commented on Aug 13, 2017

    @Trott
    Member

    Comparing 8.3.0 with 7.9.0:

    $ cat compare.csv | Rscript benchmark/compare.R 
                                                         improvement confidence      p.value
     events/ee-add-remove.js n=250000                       -30.57 %        *** 3.570833e-60
     events/ee-emit-multi-args.js n=2000000                 -13.31 %        *** 1.491800e-38
     events/ee-emit.js n=2000000                            -14.58 %        *** 1.977752e-27
     events/ee-listener-count-on-prototype.js n=50000000     12.87 %        *** 4.639347e-34
     events/ee-listeners-many.js n=5000000                   34.51 %        *** 1.745743e-50
     events/ee-listeners.js n=5000000                        19.73 %        *** 6.707594e-34
     events/ee-once.js n=20000000                           -40.54 %        *** 5.223855e-52
    $
    
  7. bmeurer commented on Aug 13, 2017

    @bmeurer
    Member

    Those numbers were taken using the 8.3.0 versions of those benchmarks?

  8. Trott commented on Aug 13, 2017

    @Trott
    Member

    Those numbers were taken using the 8.3.0 versions of those benchmarks?

    I used the version in the master branch.

  9. Trott commented on Aug 13, 2017

    @Trott
    Member

    Also: I ran it on macOS 10.12.6.

  10. vsemozhetbyt commented on Aug 13, 2017

    @vsemozhetbyt
    Contributor

    I've tested on Windows 7 x 64, vs V8 6.0 / 6.1 / 6.2 and things seem getting better:

    V8 5.5.372.43 (Node.js 7.10.1) vs V8 6.0.286.52 (Node.js 8.3.0)
                                                          improvement confidence      p.value
     events\\ee-add-remove.js n=250000                       -42.77 %        *** 4.141429e-90
     events\\ee-emit-multi-args.js n=2000000                  -7.56 %        *** 3.765808e-27
     events\\ee-emit.js n=2000000                             -9.59 %        *** 5.277457e-27
     events\\ee-listener-count-on-prototype.js n=50000000     12.72 %        *** 9.573892e-38
     events\\ee-listeners-many.js n=5000000                   21.15 %        *** 4.807840e-43
     events\\ee-listeners.js n=5000000                         6.91 %        *** 1.381210e-06
     events\\ee-once.js n=20000000                           -45.65 %        *** 1.205400e-57
    
    
    V8 5.5.372.43 (Node.js 7.10.1) vs V8 6.1.556 (Node.js 9.0.0 2017-07-20 V8-canary)
                                                          improvement confidence      p.value
     events\\ee-add-remove.js n=250000                       -12.04 %        *** 1.846156e-35
     events\\ee-emit-multi-args.js n=2000000                  10.96 %        *** 1.395131e-29
     events\\ee-emit.js n=2000000                              2.63 %        *** 5.275229e-05
     events\\ee-listener-count-on-prototype.js n=50000000      8.65 %        *** 3.501371e-33
     events\\ee-listeners-many.js n=5000000                   18.98 %        *** 3.670456e-37
     events\\ee-listeners.js n=5000000                         5.45 %        *** 8.625583e-10
     events\\ee-once.js n=20000000                           -31.56 %        *** 1.767708e-43
    
    
    V8 5.5.372.43 (Node.js 7.10.1) vs V8 6.2.217 (Node.js 9.0.0 2017-08-12 V8-canary)
                                                          improvement confidence      p.value
     events\\ee-add-remove.js n=250000                        -9.71 %        *** 7.300658e-24
     events\\ee-emit-multi-args.js n=2000000                  21.74 %        *** 5.781329e-30
     events\\ee-emit.js n=2000000                             10.67 %        *** 3.856524e-20
     events\\ee-listener-count-on-prototype.js n=50000000      6.88 %        *** 2.059200e-11
     events\\ee-listeners-many.js n=5000000                   14.08 %        *** 3.452212e-45
     events\\ee-listeners.js n=5000000                        -1.82 %         ** 1.769813e-03
     events\\ee-once.js n=20000000                           -26.43 %        *** 5.119348e-73
  11. apapirovski commented on Apr 11, 2018

    @apapirovski
    Contributor

    There doesn't seem to be much actionable here. The benchmarks should probably be updated to be more comprehensive but that's an issue across the board. The performance as per above is now nearly at par or better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    eventsIssues and PRs related to EventEmitter and the events module.performanceIssues and PRs related to the performance of Node.js.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions