Playback speed
×
Share post
Share post at current time
0:00
/
0:00

Paid episode

The full episode is only available to paid subscribers of Computer, Enhance!

Monday Q&A #18 (2023-07-03)

Answers to questions from last week's videos

Each Monday I answer questions from the comments on the prior week’s videos. Transcripts are not available for Q&A videos due to length. I do produce closed captions for them, but Substack still has not enabled closed captions on videos :(

Questions addressed in this video:

  • [00:32] “A bit offtopic: some provider touts the Minecraft game server with 1000 (!!) concurrent players. This sounds ridiculously small. Is that just because nobody really cared about performance while developing it, or scaling Minecraft game servers is inherently quadratic/polynomial/exponential due to interaction of the players?”

  • [05:50] “I wonder if there is a sane way of writing `defer` in C.”

  • [09:19] “I wonder if one should insert software (compiler) barriers (like `asm volatile("" : : : "memory")`) to those profiling macroses, so compiler doesn't reorder instructions randomly and at least a program order is correct.”

  • [15:52] “Are there any tradeoffs to be aware of with keeping the profiler data in a global namespace vs the stack of main or some other top level function?”

  • [20:41] “If using `__COUNTER__` to write into a fixed-size array, how do you handle functions called more than once? Naively, I expect something like `TimeFunction;` would either (A) overwrite the slot of the previous calls to a function or (B) write some sort of aggregate value(s) to the slot (perhaps the total elapsed time of all calls and the number of calls). Are there any better options? If not, is the fixed slot `__COUNTER__` approach only appropriate for rough high-level profiling?”

  • [26:30] “How do you deal with a situation where you call begin in one scope and exit in another and can't rely on the scopes destructors. I guess it's a rare case and it's ok not to design for it?”

  • [29:31] “What do you do if you have the a function executed by multiple threads. They will all race towards one time slot.”

  • [32:40] “How would you change this design if you write a bigger project?”

The full video is for paid subscribers

Computer, Enhance!
Programming Courses
A series of courses on programming topics.