Skip to content

process.hrtime() is much slower in 14.x #36417

Description

@spazmodius

process.hrtime() takes twice as long to execute in Node.js 14, compared to Node.js 12.

  • Version: 14.15.0 vs 12.18.4
  • Platform: Microsoft Windows NT 10.0.19041.0 x64
  • Subsystem: process

What steps will reproduce the bug?

Running benchmark/process/bench-hrtime.js in Node.js 12 and 14

> node -v
v12.18.4

> node bm\process\bench-hrtime.js
process\bench-hrtime.js type="raw" n=1000000: 19,672,995.469309144
process\bench-hrtime.js type="diff" n=1000000: 20,285,745.00412815
process\bench-hrtime.js type="bigint" n=1000000: 20,371,868.07993106
v14.15.0
        
> node bm\process\bench-hrtime.js
process\bench-hrtime.js type="raw" n=1000000: 9,509,147.32426858
process\bench-hrtime.js type="diff" n=1000000: 9,260,999.984256301
process\bench-hrtime.js type="bigint" n=1000000: 9,194,852.721446535

Activity

  1. devsnek commented on Dec 6, 2020

    @devsnek
    Member

    hrtime should be about 2x faster in v15

  2. bzoz commented on Dec 7, 2020

    @bzoz
    Contributor

    Looks like this is already fixed:

    v12.20.0
    process\bench-hrtime.js type="raw" n=1000000: 19,145,131.584489383
    process\bench-hrtime.js type="diff" n=1000000: 19,097,235.484191306
    process\bench-hrtime.js type="bigint" n=1000000: 18,287,018.411370136
    
    v14.15.1
    process\bench-hrtime.js type="raw" n=1000000: 10,456,215.121987434
    process\bench-hrtime.js type="diff" n=1000000: 10,417,621.615314737
    process\bench-hrtime.js type="bigint" n=1000000: 9,485,326.20036803
    
    v15.3.0
    process\bench-hrtime.js type="raw" n=1000000: 20,348,612.428118527
    process\bench-hrtime.js type="diff" n=1000000: 19,892,421.78299755
    process\bench-hrtime.js type="bigint" n=1000000: 23,809,977.33290158
    
  3. spazmodius commented on Dec 7, 2020

    @spazmodius
    Author

    You mean fixed in 15? Because what you posted above still shows degradation in 14.15.1

  4. added a commit that references this issue on May 28, 2021
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions