Efficient live data - defer? #1884
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Batch the data a little bit and then use defer. Defer is used in many prod apps and even if it is not ideal, it still works. A timer is probably not a super bad idea either - even if you set it at 5ms a modern CPU that has to wake up and do nothing is still going to use practically 0% CPU-time overall because 5ms is an eternity. But this of course will drain a battery if that's something you care about. But yeah a timer is probably not my favorite solution (but it could WORK). The ideal solution would be to not have any threading but only use 1 event loop and scale uniform instances of the entire app on isolated threads, lika NUMA-aware solutions (this is the intended architecture) But it depends, I don't know your circumstances and it's not for me to do your job ;) |
Beta Was this translation helpful? Give feedback.

Batch the data a little bit and then use defer. Defer is used in many prod apps and even if it is not ideal, it still works.
A timer is probably not a super bad idea either - even if you set it at 5ms a modern CPU that has to wake up and do nothing is still going to use practically 0% CPU-time overall because 5ms is an eternity. But this of course will drain a battery if that's something you care about. But yeah a timer is probably not my favorite solution (but it could WORK).
The ideal solution would be to not have any threading but only use 1 event loop and scale uniform instances of the entire app on isolated threads, lika NUMA-aware solutions (this is the intended architecture)
But it…