Add docs for JS self-profiling API#37796
Conversation
Preview URLs (6 pages)Flaws (2)Note! 5 documents with no flaws that don't need to be listed. 🎉 URL:
External URLs (2)URL:
URL:
(comment last updated: 2025-02-28 22:05:22) |
captainbrosset
left a comment
There was a problem hiding this comment.
Looks great to me from a tech writing perspective. Thanks Will.
I'll ping someone from my side to take a look at the technical details too.
files/en-us/web/api/js_self-profiling_api/profile_content_and_format/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/api/js_self-profiling_api/profile_content_and_format/index.md
Outdated
Show resolved
Hide resolved
| @@ -0,0 +1,49 @@ | |||
| --- | |||
| title: "Profiler: samplebufferfull event" | |||
There was a problem hiding this comment.
It is indeed mentioned briefly in the spec, and is implemented in chromium (it seems).
I think this should be spec'd properly, and then added to BCD.
Co-authored-by: Patrick Brosset <patrickbrosset@gmail.com>
|
see mdn/mdn#507 |
|
@captainbrosset , did you find anyone who could take a look at this? |
@wbamberg I will ask again. Thanks for the ping. |
There was a problem hiding this comment.
small correction - the stack frame has resource id which points to an index in the resources array.
There was a problem hiding this comment.
What I'm trying to talk about here is the logical structure of a profile, not the data structure of the object returned by the API. The intention in this page is to talk about the (1) the logical structure, (2) the data structure, and (3) how to map from (2) to (1).
|
|
||
| Each stack frame contains information about the location of its corresponding function in the program: | ||
|
|
||
| - The URL of the script |
There was a problem hiding this comment.
similar to the other comment - this is not the URL but an index to the URL of the script
|
Let me just say that this is great you are doing this! I'm wondering if best practices for using the Profiler should also be included to help users avoid shooting themselves in the foot. For example, it may be worth mentioning that there might be some overhead in collecting profile and processing trace data and developers should be measure performance impact carefully. Some potential strategies to address that:
Caveat - since in production systems the JS is typically minified - the captured traces will include minified function names which can be hard to reason about. Some ammonification logic has to happen wither on the client before sending or on the analytics system to un-minify the traces based on source maps. |
Yes, this makes a lot of sense! I will write something up based on your comment. Thanks for taking a look. |
|
Thanks for the review @nhelfman ! I added a bit on "best practices". I didn't change the bit about the stack frame containing the resource URL because that part is intended to describe the abstract/logical structure of a trace, not the implementation. If there's anything I can do to make that clearer I'm happy to have a go at it. |
Maybe indicate that this is an abstracted logical illustration so it will be clearer to the reader. |
|
I'm merging this, it has an r+ and has been around for a while. |
* upstream/main: (172 commits) chore: improve code style guide (mdn#38715) fix: typo on `Error.isError()` page (mdn#38754) plural consistency (mdn#38747) fix: auto-cleanup by bot (mdn#38695) Synchronize with BCD v5.7.4 (mdn#38709) Add docs for JS self-profiling API (mdn#37796) Better SameSite docs (mdn#38710) Added missing explanation for Array Literals (mdn#38745) Add a page on CSRF (mdn#38151) Fix description of several Range methods (mdn#38518) Remove extraneous span (mdn#38696) Add a definition for media containers, improve how the media files are defined and Remove wrong information (mdn#38721) Move visited selector guide to CSS selectors module (mdn#38642) Make JSON learning article more technically precise (mdn#38644) Make translate3d() interactive example code valid (mdn#38647) Clarity on Safari support for custom elements (mdn#38727) feat(css): Link to learning doc about text direction (mdn#38719) Fix typo (mdn#38739) move guide to module: inline formatting context (mdn#38637) Fix CSS pseudo-class lists (mdn#38576) ...
* Add docs for JS self-profiling API * Apply suggestions from code review Co-authored-by: Patrick Brosset <patrickbrosset@gmail.com> * Review feedback * Clarify that 'anatomy of a profile' doesn't describe object format * More clarification --------- Co-authored-by: Patrick Brosset <patrickbrosset@gmail.com>
Docs for the JS Self-Profiling API.
samplebufferfullwhich is mentioned in the spec but not defined, and which doesn't have a BCD entry yet.