Show HN: O(log n) makes continuous profiling possible
Coming from a Rust game development background, something that's noticeable to me is that sampling based profiling seeks to solve a different problem than the types of questions games need to answer.<p>With sampling you can say "I saw function() 100/150 samples (10ms interval between samples), spend your time looking at that!".<p>That doesn't really work for games, where your work is on the scale of 0.1ms, and you might call the same function 100's of times in 16ms. Calling update_object() 1000 times an interval isn't actually a problem, when it's only taking 5% of your overall frame budget (on average). Games also have the constraint of not wanting your profiling to throw off the game speed itself, it needs to run very fast.<p>With games, what you really want to know are:<p>1. Which frames are taking over 16ms? (On the current machine; what's fast enough on one computer isn't on weaker machines. Sometimes you want to look at every frame, and not just the slow ones.)<p>2. What functions are causing them to go over?<p>3. Are those functions _usually_ that slow? How fast do they usually run, was this just an uncommon edge case? Mean/median/90th percentile performance?<p>With typical applications, instead you want to know<p>* Of the many diverging branches and tasks my application can do, which areas occur the most often, and are therefore worth spending time optimizing?<p>Sampling based profiling obviously works better for applications like this, while non-sampling profiling works better for games. Sadly, there doesn't seem to be very many GUIs/APIs for working with the latter, especially with linux compatibility. I'm hoping to remedy this, as soon as I get better at GTK.<p>EDIT: An example of why sampling based profilers (in this case, perf) aren't great for games. Although sandbox::sandbox::Sandbox::temperature_update takes up a decent amount of overall time, it's hard to tell whether that matters per frame or not.<p><a href="https://profiler.firefox.com/public/c4y22fect9qg9mfm0wv0pjweacpvpqz204y2by8/calltree/?globalTrackOrder=0&localTrackOrderByPid=560138-0-1~&thread=0&timelineType=stack&v=5" rel="nofollow">https://profiler.firefox.com/public/c4y22fect9qg9mfm0wv0pjwe...</a>