Paid episode

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

Q&A #23 (2023-08-21)

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. 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:56] “How are we handling recursion with bandwidth measurements? If a function is called with some data, processes some of it and then calls itself to process the rest, it would be easy to overcount how much data went through it.”

  • [05:16] “I have a question about your flood fill answer for your interview question #3.

    You mentioned to create a mask = 0b10101010, then to AND it with your result and shift it to the right and AND it with the result again to check if there are two 1 bits next to each other. Then you give a warning about making sure to do it unsigned ensuring its a logical shift and not an arithmetic shift.

    My question is:

    If you made the mask = 01010101 followed the same steps and then did a left shift... you would never need to worry about this warning... it will always be a logical shift

    so I mean... isn't that a better way to do it? I mean its just the mirrored version of the same operation but it seems a bit safer right? or am I missing something.“

  • [09:19] “This isn't really a question per se but at work we do a lot of stuff in go. I was curious about how the time.Now() function worked in comparison to what we built in C and found this as part of the implementation… From my understanding, go is relying on the os rather than direct cpu calls which is about what I would expect for cross compatibility reasons. Maybe that's the better place to end the deep dive? If I know we are using the os in go then I can reason about the perf implications of that and decide whether or not it's good enough without actually understanding the full implementation.”

  • [15:10] “Sorry beforehand since this question is completely unrelated to the course. I'm planning on starting a startup with some friends and handle all tech related stuff. I'd love to do it in a way that everything is clear what is happening like in this course.

    However, I don't have any idea on where to look for on how to do server/backend stuff from scratch like here. Where should I learn all this stuff from that is similar to you? how to create a program that'll be a server handling multiple connections at the same time, and make TCP calls to others per connection, in a sane way like in this course? All I feel right now is that it'll be a bad idea since in all the companies I've worked there's a really thick wrapper around others HTTP servers and HTTP clients.”

  • [26:22] “Sometimes I get bogus results in profiler with very high own (exclusive) time of a block. I've added some diagnostics and it looks like rdtsc on block close is less than rdtsc on start, but value is not wrapped around. It might be a bug which I didn't find yet, but is it possible that rdtsc instructions are reordered?”

The full video is for paid subscribers

Programming Courses
A series of courses on programming topics.