Performance expectations—1.5-2% CPU usage reasonable? #535
Replies: 1 comment 10 replies
-
Hi @joshcbrown, thanks for doing a bunch of legwork to dig into this. As for what to expect, I can't say; what you're seeing doesn't seem outrageous to me, but it's possible it could be reduced somewhat. I ran Brick's In general, I would definitely not expect runtime behavior of Haskell to match Rust. Rust is definitely going to be leaner due to it not having GC and having a comparatively very lightweight runtime system. Plus, there are a ton of libraries involved in a Brick application that make an apples-to-apples comparison impossible. Also, since I did want to take a look at your source to see what might be going on, I noticed a few things. In zoom ts $ handleTaskEvent (DeleteAt i)
zoom ts $ handleTaskEvent (InsertAt i task) These can be bundled up as follows: zoom ts $ do
handleTaskEvent (DeleteAt i)
handleTaskEvent (InsertAt i task) (or factored out of For now I guess I'd say the behavior you're seeing is what I'd expect, but expectations are subjective. I'm happy to leave this open as a reminder to do some profiling on Brick to see if the GC overhead can be reduced. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there!
I'm building a small app for a pomodoro timer and task management. The app currently looks like this:
When the timer is running, I redraw the app (minus the stats widget which I cache) four times every second and CPU usage sits at about 1.5-2% (idle, it sits at 0% as you'd hope). This isn't enough to make a noticeable impact elsewhere on the system, but just curious whether this is what you'd expect?
A previous project that I wrote in Rust consumes almost nothing while active. I wouldn't think the language/library should make that much of a difference given that the vast majority of the time, the app's sleeping.
I did some profiling to confirm this:
Over 99% of the time is idle. I note also that the second-most time-consuming activity is GC. Maybe the extra overhead is mostly from that? If you like, you can view this graph at speedscope with this JSON.
I won't ask you to read the code, but if you'd like to, it's available here.
Thanks very much in advance, and thanks for building such a fun library to work with! Appreciate your work.
Beta Was this translation helpful? Give feedback.
All reactions