Playback speed
Share post
Share post at current time

Paid episode

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

Q&A #53 (2024-05-06)

Answers to questions from the last Q&A thread.

In each Q&A video, I answer questions from the comments on the previous Q&A video, which can be from any part of the course.

Questions addressed in this video:

  • [00:03] “Do you use the C++ bool type at all, does it make sense to use it from a performance standpoint? Which type do you use for booleans in general and in SIMD code?”

  • [13:42] “Would you say the way you taught multi-threading in Handmade Hero still holds up?”

  • [16:37] “How do stores actually interact with the cache?”

  • [22:28] “ I'm suspicious that doing repeated writes to the same memory might force some sort of a cache flush, which doesn't seem to be a problem if no one else is reading that memory, but in the case of PCIe transfer the average throughput of repeated tests of writing 4K is essentially the same as writing 64MB. It seems like doing repetition testing in this case is not correct. Are there some techniques to test behavior that's sensitive to repetition?””

  • [26:40] “The test with non-temporal stores is ~3x faster than the test with regular store, but still doesn't reach even the L3 speed. Is it expected?”

  • [29:06] “Let's say I allow the users of my game to take a screenshot and then encode the texture to PNG and save it to a file. I'm sure at least the final encodeToPNG's result can be copied to an array using movntdq. The texture itself might be useful to be shown in the UI or you might need it for something else.

    then you'll call fprintf or something to write the array to a file.

    Is this a valid non-temporal storage use-case or not?”

  • [32:55] “Since you talked about language design here, many years ago i could get very excited about type system related features because I assumed they can help a lot finding your mistakes at compile time. What do you think about type system related features and things like monads, traits and having compile time detectable error values/non-null types and their ability to improve your code base/productivity/reduce defect rate?”

The full video is for paid subscribers

Programming Courses
A series of courses on programming topics.