oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.05k stars 2.67k forks source link

Profiling a script without macOS #11360

Open leeoniya opened 3 months ago

leeoniya commented 3 months ago

What is the problem this feature would solve?

help Bun users optimize their code for JSC, which differs from V8.

for example, i discovered that JSC goes faster and uses much less memory when avoiding a lot of string concats. V8 uses a lot more memory both before and after avoiding string concat.

but i only discovered this through experimentation / educated guesswork which could have been avoided with a some kind of profiler.

What is the feature you are proposing to solve the problem?

are there any plans to provide a way to record and view profiles in Bun?

my use case is pretty simple. i have a self-contained lib with no dependencies and does not use any bun-specific or node-specific features. i'm on linux and cannot easily spin up safari to profile this thing in webkit/jsc.

What alternatives have you considered?

buying a mac :D

Jarred-Sumner commented 3 months ago

Have you tried bun --inspect? The profiler there doesn’t have an operating system requirement

leeoniya commented 3 months ago

thats just a debugger tho, right? not a profiler. it can't give me a flame chart or heap alloc timeline or line-level on-stack timings / call graphs. like the performance tab in chrome's devtools.

Jarred-Sumner commented 3 months ago

It has a profiler too. It’s Safari’s devtools exported as a standalone webapp.

On Sat, May 25, 2024 at 7:21 PM Leon Sorokin @.***> wrote:

thats just a debugger tho, right? not a profiler. it can't give me a flame chart or heap alloc timeline or line-level on-stack timings / call graphs. like the performance tab in chrome's devtools.

— Reply to this email directly, view it on GitHub https://github.com/oven-sh/bun/issues/11360#issuecomment-2131990189, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFNGSYQV5XDHVOTDGQUK4TZEFBKVAVCNFSM6AAAAABIJL6W6CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZRHE4TAMJYHE . You are receiving this because you commented.Message ID: @.***>

leeoniya commented 3 months ago

https://profiler.firefox.com/ supports multiple profile formats, maybe producing something that can be viewed there would work...

leeoniya commented 3 months ago

It has a profiler too. It’s Safari’s devtools exported as a standalone webapp.

hmm, okay will try. thanks!