Skip to content

Performance regression in v12 caused by primordials #29766

Closed
@joyeecheung

Description

@joyeecheung

I have heard about performance regressions caused by transition to primordials in v12, but couldn't find a tracking issue for the regression, so opening this to make sure we are tracking it and can work with the upstream to get this handled, on way or another (feel free to close this if there is already an issue opened here).

The regressions seem to come from two types of code patterns:

  1. Calling functions through Function.prototype.{call, apply} instead of just calling them directly. There is an issue opened in the upstream by @bmeck
    https://bugs.chromium.org/p/v8/issues/detail?id=9702
  2. Looking up properties from fronzen objects - objects from our primordials namespace are frozen so lookups like const { Reflect } = primordials; Reflect.apply(...); is slower than just Reflect.apply when Reflect comes from the global object. This can be mitigated by caching the lookup results upfront, e.g. event: improve performance of EventEmitter.emit #29633 by @mcollina There is also a fairly odd tracking issue for this in the upstream: https://bugs.chromium.org/p/v8/issues/detail?id=6831

cc @MylesBorins (https://twitter.com/MylesBorins/status/1173390304742785024)

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceIssues and PRs related to the performance of Node.js.v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions