simonepri / simonepri/sympact

Timestamps in nanoseconds

Open
#2 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
441
Forks
14
PR merge metrics
No merged PRs in 30d

Description

I'm submitting a

  • feature request

Checklist

  • Searched both open and closed issues for duplicates of this issue
  • Title adequately and concisely reflects the feature or the bug

Information

sympact@0.0.3

The Problem

Timestamps are in ms (milliseconds). So, under certain circumstances, the difference between end and start is always zero ms. E.g: when profiling code that do not require long times to execute

Suggested solution

I would like to suggest timestamps in ns (nanoseconds). That could be achieved by replacing Date.now() for process.hrtime() in ./lib/profile.js. That would also require parsing the hrtime format with a function like this one:

function parseTime(hrtime) {
  return (hrtime[0] * 1e9) + hrtime[1]
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the timestamp logic in the referenced profiler file, noting the issue links ./lib/profile.js while naming profiler.js, and review how Date.now() values are consumed. Replace millisecond timing with parsed process.hrtime() values so short profiling intervals are nonzero, then verify the reported start and end difference uses nanoseconds.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
devtools, performance
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.