Allow raw marker table's startTime and endTime columns to be Float64Array#6169
Conversation
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
4508904 to
c06d9ba
Compare
canova
left a comment
There was a problem hiding this comment.
Thanks! I think maybeAddMetricMarker comment is a real bug, but others are mostly questions.
| thread.markers.category.push(testingCategoryIdx); | ||
| thread.markers.data.push(payload ?? null); | ||
| thread.markers.length++; | ||
| const markers = getRawMarkerTableBuilderFromExisting(thread.markers); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Oops indeed! Fixed.
| // @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 |
There was a problem hiding this comment.
Ah weird, thanks for the explanation!
Do we have checks like num === null in some places though? Can it be a problem?
There was a problem hiding this comment.
For marker startTime and endTime, the only null checks I can find are checks in the form of ensureExists:
profiler/src/profile-logic/profile-data.ts
Lines 1496 to 1515 in bd2a5cf
profiler/src/profile-logic/marker-data.ts
Lines 682 to 683 in bd2a5cf
There was a problem hiding this comment.
So this code would already be throwing exceptions if it encountered nulls in places where the phase wants a non-null value.
There was a problem hiding this comment.
Ah that makes sense, thanks for checking!
c06d9ba to
0c507ac
Compare
0c507ac to
e83d8d9
Compare
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.