Live data from Hacker News

Show HN: Spall – WASM-based profiler for JavaScript and C and Odin

gravitymoth.com

1–10 of 22 posts

Show HN: Spall – WASM-based profiler for JavaScript and C and Odin

#1
[I'm the author] Spall is a web-accessible profiler that I made to help my web-dev friends load gigabyte+ JSON traces without lunch-break-long load times. Recently, Spall got experimental support for auto-tracing with binary traces (along with an in-progress native-port, to give it more memory headroom), which was used to help track down and fix some hard-to-spot lock contention issues in the Odin-language compiler.

I demoed it at the Handmade Seattle conference in October, https://guide.handmade-seattle.com/c/2022/spall/, with a head-to-head against Perfetto, another big web profiler.

I'll be around to answer any questions. Thanks for looking at my project! If you like Spall, you can catch my other projects over at https://colrdavidson.github.io/.

If you happen to be hiring I'd love to hear from you. Looking for something fun and new to do after a long sabbatical, working on cool open-source projects!

Show HN: Spall – WASM-based profiler for JavaScript and C and Odin
gravitymoth.com

Re: Show HN: Spall – WASM-based profiler for JavaScript and C and Odin

#2
The comparison with Perfetto in the video is pretty damn impressive. So nice to have another player in the profiler space. Iteration time is unfortunately (and inexplicably) undervalued. My short time messing around with SpeedScope was more promising, but profiling in general has been pretty painful with all of the tools I've tried that ingest auto-traced input.

You mention in the "For Everyone Else" section that you have an auto-tracer system to instrument all your tracing. Aside from being very handy, how does it compare to [1] which you mention right after?

[1] https://github.com/bvisness/dtrace2spall

Re: Show HN: Spall – WASM-based profiler for JavaScript and C and Odin

#4
post #2

The comparison with Perfetto in the video is pretty damn impressive. So nice to have another player in the profiler space. Iteration time is unfortunately (and inexplicably) undervalued. My short time messing around with SpeedScope was more promising, but profiling in general has been pretty painful with all of the tools I've tried that ingest auto-traced input. You mention in the "For Everyone Else" section that you…

So, dtrace2spall is going to generate much smaller files and impact runtime less, because it samples with dtrace, and then converts the data to spall's format as a post-pass.

Auto-tracing is far more comprehensive, but it's a big datadump, and it does impact runtimes a bit more.

So far I've mostly used auto-tracing to figure out how bigger pieces of code work, rather than strictly for profiling. It was super helpful trying to walk through the more complicated parts of the Odin compiler to fix things, being able to see the order of functions called on the timeline.

Re: Show HN: Spall – WASM-based profiler for JavaScript and C and Odin

#5
I recently read about this on the Odin monthly news, it was super impressive!

In the section of the interview where you talk about the difficulties you had, you discuss the challenges of making Odin work properly on WASM, and how you needed custom memory-management and allocation strategies.

Could you talk some more about that experience and the general process of working with that sort of low-level bit in Odin? I've been experimenting with using Odin to write a DB from scratch.

Re: Show HN: Spall – WASM-based profiler for JavaScript and C and Odin

#6
post #5

I recently read about this on the Odin monthly news, it was super impressive! In the section of the interview where you talk about the difficulties you had, you discuss the challenges of making Odin work properly on WASM, and how you needed custom memory-management and allocation strategies. Could you talk some more about that experience and the general process of working with that sort of low-level bit in Odin? I've…

The interview in question, for those interested: https://odin-lang.org/news/newsletter-2022-12/#interview-wit...

Re: Show HN: Spall – WASM-based profiler for JavaScript and C and Odin

#7
post #5

I recently read about this on the Odin monthly news, it was super impressive! In the section of the interview where you talk about the difficulties you had, you discuss the challenges of making Odin work properly on WASM, and how you needed custom memory-management and allocation strategies. Could you talk some more about that experience and the general process of working with that sort of low-level bit in Odin? I've…

Sure! So far, Odin has been awesome for doing custom allocation. Everything in the core library that allocates takes an optional allocator parameter, which means that you can use quite a few of the core libraries comfortably even in embedded contexts, and make it all sit on top of an arena in WASM's weird memoryland if you need to without an issue.

Outside of the WASM context where Odin runs into some difficult friction, systems-level work has been reasonable. I wrote a good chunk of a C/DWARF debugger in both C and Odin to compare, and Odin was by far the more pleasant language to write it in, my Odin code was much smaller because I didn't need xmacros, and I had proper namespaced enums, tagged unions, and slices, but still looked/read pretty similarly to well-written C or Go. I did have to wrap a few syscalls myself though, because the core library doesn't quite cover things like ptrace or networking yet.

I've put a fair bit of work into getting cross-platform networking into Odin's core library, hopefully we'll see it show up soon enough, and get some of those common nice-to-haves crossed off.

Re: Show HN: Spall – WASM-based profiler for JavaScript and C and Odin

#8
post #5

I recently read about this on the Odin monthly news, it was super impressive! In the section of the interview where you talk about the difficulties you had, you discuss the challenges of making Odin work properly on WASM, and how you needed custom memory-management and allocation strategies. Could you talk some more about that experience and the general process of working with that sort of low-level bit in Odin? I've…

Sure! So far, Odin has been awesome for doing custom allocation. Everything in the core library that allocates takes an optional allocator parameter, which means that you can use quite a few of the core libraries comfortably even in embedded contexts, and make it all sit on top of an arena in WASM's weird memoryland if you need to without an issue. Outside of the WASM context where Odin runs into some difficult frict…

Awesome, thanks for the reply! Looking forward to seeing those hit core hopefully!

Re: Show HN: Spall – WASM-based profiler for JavaScript and C and Odin

#9
post #5

I recently read about this on the Odin monthly news, it was super impressive! In the section of the interview where you talk about the difficulties you had, you discuss the challenges of making Odin work properly on WASM, and how you needed custom memory-management and allocation strategies. Could you talk some more about that experience and the general process of working with that sort of low-level bit in Odin? I've…

Sure! So far, Odin has been awesome for doing custom allocation. Everything in the core library that allocates takes an optional allocator parameter, which means that you can use quite a few of the core libraries comfortably even in embedded contexts, and make it all sit on top of an arena in WASM's weird memoryland if you need to without an issue. Outside of the WASM context where Odin runs into some difficult frict…

Impressive work! Where is the net package getting worked on? Is it the "core_net" branch or do you have your own fork?
Post reply on HN