Closed Bug 1727036 Opened 4 months ago Closed 3 months ago

Space-optimize the JSON output of times in milliseconds

Categories

(Core :: Gecko Profiler, task, P2)

task

Tracking

()

RESOLVED FIXED
93 Branch
Tracking Status
firefox93 --- fixed

People

(Reporter: gerald, Assigned: gerald)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

One of the ideas from bug 1726675:

  • Unneeded precision. These numbers being relative times (in milliseconds), a precision better than nanoseconds (fast processors may fit 3-4 cycles per nanosecond) is probably wasted space. So we could already round the above numbers to 361.655600, 363.035000, 0.166667.

And it would be easy to remove the trailing zeroes as well.

Eventually we will probably move to integer number of nanoseconds, but for now this is a quick win with little effort, and it doesn't require any changes on the front-end.
Bonus: It will separate the time-related outputs functions, so it will also help with future changes to times.

Instead of blindly outputting floating-point numbers of milliseconds, which leads to things like 363.03499999999997, times in ms are now converted to integer number of nanoseconds, stringified, and then manually adjusted to milliseconds again, so we get smaller and friendlier outputs like 363.035.

Eventually, bug 1726675 may change all times to integer number of nanoseconds anyway, but this patch is already helpful in reducing the output, and paves the way by separating the time-output functions from other number outputs.

Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 93 Branch
You need to log in before you can comment on or make changes to this bug.