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.
The questions addressed in this video are:
[0:00:03] “Building on using free lists to manage objects with complex lifetimes, how do you handle cases where an object type can vary in size?”
[0:02:33] “Can you go into more detail about how to handle IO with queues vs callbacks? A small example on the fancy light-board would be nice.”
[0:07:14] “With the recent widespread usage of AI to program in the industry and a fierce push from upper management to enforce usage of AI in development tasks, I am finding myself less and less motivated to program, and also depressed. I have mostly ceased my programming activities outside of working hours.
Do you have any advice on how to deal with the AI wave and also to continue motivated to program as a hobby and professionally in this environment?”
[0:20:00] “Now that you are switching to Linux in full swing have you ported your codebases or what’s your strategy? I did the opposite thing and fled from Linux because I wanted to start my first big codebase in a more stable environment so it has been the year of the Windows desktop for me which after running a debloat script hasn’t actually been bad, nevertheless seeing Microsoft’s behavior does have me yearning for the penguin, and knowing how painful releasing something for Linux is has me wondering if programming against the windows API and using Wine for most of one’s graphical software is a valid way to proceed.”
[0:29:50] “How much of the software you currently write is based on your own thoughts and creativity? I’ve found myself relying heavily on reading and using open-source projects where similar problems were already solved. After a while, this started to make me feel like an impostor. Do great programmers like yourself write their own code, or do they adapt and build on existing work?”
[0:35:38] “This maybe jumping the gun a fair bit. but when you say back of the envelop calculation, does that include the time complexity of whatever algorithm to do correctly?”
[0:39:45] “Have you ever written anything in ISPC? From my experience it seems much easier to write than rolling the simd myself, and much more portable.”
[0:42:10] “Do you have any recommendations on how to use ‘pen & paper’ in the software development process? I’ve noticed that drawing a problem helps me visualize the problem easier than jumping straight into coding. I’m working with MIDI and writing a document explaining in my own words how does MIDI encode data helped me in unexpected ways. I’m wondering if I’m missing out on any other ‘pen & paper’ practice. Any useful tips?”
[0:46:47] “Hello I come with another question. How does one go about implementing smooth window resizing with Dangerous Thread Crews? I have the two threads and do get non-blocking resizing but the UI contents of the window jiggle and stretch a bit when resizing (which gets way worse with vsync) and nothing I try (like adding synchronization and using WM_WINDOWPOSCHANGING to allow only one resize per frame) gets rid of the apparent discrepancy between the window size and the size my renderer targets that causes some ugliness. The only reference I have of a program that has smooth resizing and doesn’t achieve this by updating on each WM_PAINT is your refterm program but I don’t see any glaring differences between the way you rendered stuff there and it seems like there you just called GetClientRect on each update with no need for anything else... so am I just doing something dumb and missing something or is there some computer wizardry I need to invoke to fix this when programming more complex UIs?”
[0:51:06] “In this talk about pathfinding in Age of Empires 2, around the 15-16 minute mark, he mentions turning off SIMD because they were losing floating point precision. I don’t understand why that was the case for them, can you provide more insight?”
[1:01:33] “I’ve been trying to test how many simultaneous loads can I get with the repetition tester when I do 1, 2, 3 or 4 moves in a loop on the two machines I have access to. My laptop (which has Intel Skylake chip) reports that the memory bandwidth doubles only when I go from 1 to 2 moves per loop, which is expected and reproduces your results from the course. But when I do the same on my desktop (which has Intel Raptor lake chip), the results are the same. The Raptor lake apparently have two type of cores: P-cores and E-cores, where E-cores also have 2 ports capable of executing loads, while P-cores are supposed to be equipped with 3 ports of that type (at least that’s what I read in Agner Fog manual). To my understanding it means that I should see a bandwidth bump when going from 1 to 2 moves per loop, and when going from 2 to 3 moves per loop. But that doesn’t happen, I see only one bump (from 1 to 2 moves). I guess that there are some nuances with running the tester on this system that I might not be aware of. But one of them - which is clear to me - is that it is the OS who decides on which core should the tester be run on. So I set the affinity of the tester to CPU1 to make sure that it runs on the P-core. Process Explorer confirmed that it runs on CPU1. But I still could not see the improvement when going from 2 to 3 memory reads. Then I repeated the test with all the cores (one at a time), but I saw no difference in the results.
It is either my test setup that’s completely broken, or some other factor that I can’t see which prevents the bandwidth improvement of a 3 reads loop. I would be grateful if you could give me some pointers here.”
[1:07:25] “What are your thoughts about the new dynamicdeopt in msvc that lets you run optimized builds that you can debug with full information because they switch the executable on the fly?”
[1:08:15] “I’d like to ask you about the pass-by-ref vs pass-by-value ‘debate’. Traditional C++ advice is ‘always pass by const& anything bigger than 8 bytes’, but I’ve recently started seeing some people advocate that 16 byte structs should also be pass-by-value. I know that you couldn’t care less about const, and you do seem to pass by value small stuff without worrying too much about it in your own code, so .. is there anything I’m failing to consider here? is this a stupid thing to worry about in the abstract, or is there some general principle that could be useful to keep in mind here?”
