Skip to content

Allow raw marker table's startTime and endTime columns to be Float64Array#6169

Merged
mstange merged 1 commit into
firefox-devtools:mainfrom
mstange:push-nlvpounklukz
Jul 15, 2026
Merged

Allow raw marker table's startTime and endTime columns to be Float64Array#6169
mstange merged 1 commit into
firefox-devtools:mainfrom
mstange:push-nlvpounklukz

Conversation

@mstange

@mstange mstange commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Main | Deploy preview

The "raw" vs "derived" split for markers is a bit different than for the other tables, but regardless, it turns out we can just make the raw version take typed arrays without much trouble. We just needed to add the builder.

@mstange
mstange requested a review from canova July 10, 2026 23:16
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.74576% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.62%. Comparing base (1373a9d) to head (0c507ac).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/profile-logic/process-profile.ts 72.72% 6 Missing ⚠️
src/utils/typed-arrays.ts 0.00% 2 Missing ⚠️
src/profile-logic/data-structures.ts 83.33% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #6169    +/-   ##
========================================
  Coverage   83.62%   83.62%            
========================================
  Files         345      346     +1     
  Lines       37051    37165   +114     
  Branches    10270    10425   +155     
========================================
+ Hits        30983    31080    +97     
- Misses       5640     5657    +17     
  Partials      428      428            

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mstange
mstange force-pushed the push-nlvpounklukz branch 2 times, most recently from 4508904 to c06d9ba Compare July 13, 2026 18:07

@canova canova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think maybeAddMetricMarker comment is a real bug, but others are mostly questions.

Comment thread src/profile-logic/process-profile.ts Outdated
thread.markers.category.push(testingCategoryIdx);
thread.markers.data.push(payload ?? null);
thread.markers.length++;
const markers = getRawMarkerTableBuilderFromExisting(thread.markers);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it looks like on every marker addition we are cloning the whole marker table (we are in the maybeAddMetricMarker function here). Can we call this before and maybe pass as a param?

Also checked the other getRawMarkerTableBuilderFromExisting calls but they look good to me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops indeed! Fixed.

Comment thread src/utils/typed-arrays.ts
Comment on lines +26 to +32
// @ts-expect-error "Type '(number | null)[]' is not assignable to type 'ArrayLike<number>'."
// I'd say the types for the Float64Array constructor are too strict; in
// practice, passing arrays with null elements has the exact behavior we
// want here: Those elements become zeros, because "ToNumber(null)" is
// defined to be zero.
// https://tc39.es/ecma262/multipage/ordinary-and-exotic-objects-behaviours.html#sec-typedarraysetelement
// https://tc39.es/ecma262/multipage/abstract-operations.html#sec-tonumber

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah weird, thanks for the explanation!

Do we have checks like num === null in some places though? Can it be a problem?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For marker startTime and endTime, the only null checks I can find are checks in the form of ensureExists:

switch (markerPhase) {
case INSTANT:
case INTERVAL_START: {
const startTime = ensureExists(maybeStartTime);
result.start = Math.min(result.start, startTime);
result.end = Math.max(result.end, startTime + interval);
break;
}
case INTERVAL_END: {
const endTime = ensureExists(maybeEndTime);
result.start = Math.min(result.start, endTime);
result.end = Math.max(result.end, endTime + interval);
break;
}
case INTERVAL: {
const startTime = ensureExists(maybeStartTime);
const endTime = ensureExists(maybeEndTime);

const endStartTime = ensureExists(maybeStartTime, ensureMessage);
const endEndTime = ensureExists(maybeEndTime, ensureMessage);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this code would already be throwing exceptions if it encountered nulls in places where the phase wants a non-null value.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that makes sense, thanks for checking!

Comment thread src/profile-logic/data-structures.ts
@mstange
mstange force-pushed the push-nlvpounklukz branch from c06d9ba to 0c507ac Compare July 15, 2026 11:29
@mstange
mstange requested a review from canova July 15, 2026 11:34

@canova canova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment thread src/profile-logic/process-profile.ts
@mstange
mstange force-pushed the push-nlvpounklukz branch from 0c507ac to e83d8d9 Compare July 15, 2026 16:17
@mstange
mstange enabled auto-merge July 15, 2026 16:18
@mstange
mstange merged commit de4af45 into firefox-devtools:main Jul 15, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants