Convert eligible columns to typed arrays when outputting from profiler-edit - #6167
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6167 +/- ##
==========================================
- Coverage 83.55% 83.49% -0.07%
==========================================
Files 343 344 +1
Lines 36859 36882 +23
Branches 10357 10241 -116
==========================================
- Hits 30796 30793 -3
- Misses 5635 5661 +26
Partials 428 428 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| export function toInt32Array( | ||
| arr: Array<number> | Int32Array<ArrayBuffer> | ||
| ): Int32Array<ArrayBuffer> { | ||
| return arr instanceof Int32Array ? arr : new Int32Array(arr); | ||
| } | ||
|
|
||
| export function toUint8Array( | ||
| arr: Array<number> | Uint8Array<ArrayBuffer> | ||
| ): Uint8Array<ArrayBuffer> { | ||
| return arr instanceof Uint8Array ? arr : new Uint8Array(arr); | ||
| } | ||
|
|
||
| export function toFloat64Array( | ||
| arr: Array<number> | Float64Array<ArrayBuffer> | ||
| ): Float64Array<ArrayBuffer> { | ||
| return arr instanceof Float64Array ? arr : new Float64Array(arr); | ||
| } |
There was a problem hiding this comment.
Nit: I wonder if it's better to move them to a utils file?
There was a problem hiding this comment.
Yeah I wasn't sure, but I've gone ahead and moved it to src/utils/typed-arrays.ts now.
| * of the file. | ||
| * | ||
| * Profile compaction already handles the columns that reference other tables; | ||
| * this function handles the remaining eligible columns. |
There was a problem hiding this comment.
Hm, so this requires the compaction to run before this. I don't love that coupling. Should we include these fields no matter what?
Since the toInt32Array etc. functions that we added already check if they are typed array, it should be no extra cost to add them here.
There was a problem hiding this comment.
Good point. I've made that change.
281bda2 to
3d43eac
Compare
…r-edit. profiler-edit runs profile compacting on the output profile, and profile compacting converts some columns to their typed array form but not others - it only touches columns which contain indexes which refer to other tables. So this is done as a separate pass over the profile. We'll be able to use this new function for the "upload profile" code path once we switch that to uploading JSLB files; before we make that change, converting to typed arrays would be a waste because serializing to JSON would need to convert them back to regular arrays again.
3d43eac to
fe04f38
Compare
Changes: [Sky Ning] Skip preview links for non-main PRs (#6161) [spokodev] fix(gecko-upgrade): don't crash on a counter with empty sample_groups (#6160) [fatadel] Show counter values over time in profiler-cli (#6136) [Markus Stange] Make profile-conversion snapshots more compact and meaningful (#6152) [Markus Stange] More typed arrays: sample + counter times, some frametable columns (#6139) [Nazım Can Altınova] Only render a marker url field as a link when the whole value is a URL (#6163) [fatadel] Show each counter's owning process in profiler-cli (#6164) [Nazım Can Altınova] Document the pre-existing thread info and network JSON schemas in the cli (#6171) [Markus Stange] Copy column contents in getRawSamplesTableBuilderFromExisting for consistency (#6168) [Markus Stange] Convert eligible columns to typed arrays when outputting from profiler-edit (#6167) [Markus Stange] Remove unused samples.thread column (#6151) [Markus Stange] Fixed botched merge which broke 'yarn ts' (#6174) [Nazım Can Altınova] Add marker handles to `profiler-cli thread network` (#6172) [Markus Stange] Update json-slabs 0.3.0 → 0.4.0 (major) (#6176) [Nazım Can Altınova] Surface network activity across profiler-cli (#6175) [Nazım Can Altınova] Add `profile meta` command to profiler-cli (#6177) [Markus Stange] Allow raw marker table's `startTime` and `endTime` columns to be Float64Array (#6169) [nightcityblade] Fix light theme text selection colors (#6186) [Nazım Can Altınova] Import source map URLs from Chrome DevTools traces (#6190) [Nazım Can Altınova] Rename yarn `build-profiler-cli` script to `build-cli` (#6191) [Nazım Can Altınova] Migrate husky to version 9 (#6201) [Nazım Can Altınova] Fix horizontal overflow when the transform navigator is long (#6199) [fatadel] Add a 'hexadecimal' marker schema field format (#6197) [Nazım Can Altınova] Bump source-map to 0.8.0 and remove the old type workaround (#6202) [Nazım Can Altınova] 🔃 Sync: l10n -> main (July 21, 2026) (#6209) And special thanks to our localizers: fr: parmegiani.thomas fr: Théo Chevalier sr: Марко Костић (Marko Kostić) sv-SE: Luna Jernberg tr: Grk zh-CN: Ariel zh-CN: Olvcpr423
Main | Deploy preview
profiler-edit runs profile compacting on the output profile, and profile compacting converts some columns to their typed array form but not others - it only touches columns which contain indexes which refer to other tables. So this adds a separate pass over the profile to "optimize the profile for storage".
We'll be able to use this new function for the "upload profile" code path once we switch that to uploading JSLB files; before we make that change, converting to typed arrays would be a waste because serializing to JSON would need to convert them back to regular arrays again.
I had these patches applied when I generated the "after" profile in #6139 (comment) - without this, profiler-edit would have left most of those columns alone and the size profile wouldn't have looked much different.