…is that it doesn’t help against a depressive day.
My life is awesome. Even when not considering how it would be like if I was born in a ghetto. I’m healthy, I’m doing interesting studies, I have a fantastic girlfriend, and I have one of the coolest hobbies in the world, namely trying to solve a though problem whose solution could greatly benefit to my specie (or, at the very least, my relatives and the geeky part of my specie). But sadly, I’m still a human being, and when I’m tired enough or just got badly psychologically hurt, I manage to still be complaining about tiny parts of my life…
- That I lose hours mindlessly browsing the web and going on my holy war against fanboys instead of spending this time doing something actually useful.
- That I’m not sure I’ve done the best things in the past and have the best plans for the future (though I can’t think of a better idea) and other deep philosophical questions like that.
- That even when I finally manage to sit and code, without getting distracted, I’ve recently got work done about as fast as a snail with a Pentium II on its back.
Well, the last one is particularly daunting and of interest for you, so let’s put some details. When I got some working physical memory allocation code, I was extremely happy and impressed that I made that thing work so quickly, and thought that I could just finish the whole memory management code before the end of vacations. Well, it’s the end of vacations today, and I’ve trashed a lot of design drafts, but the paging management code written so far is less than 100 LOC long. All in headers.
There are two explanations for this. The first one is that I took part of this time to carefully polish the physical memory management code, now that I’ve a working codebase that’s ready to be tortured. I tried and managed to make it faster without wasting a single extra bit of memory, and to make the code much cleaner through better consistency in variable naming and better use of line feeds. I also corrected some mistakes which would have been problematic in the long run, like some functions not checking the mutex before accessing a critical resource. I think I can’t make these ~600 lines of code any cleaner or better-performing without increasing complexity by an order of magnitude. Which would be silly, as I’ll explain later.
Then there’s the design hell. I’m not fast at designing things, because I always begin each design work by trying to find the most elegant and efficient solution to my problem. Even when I know that I’ll always end up using a linked list because it’s probably good enough, ultimately flexible, and easy to code. And because I can’t tell if I even need the extra performance of more complex solutions anyway.
The main problem in my opinion, the main thing which slows down my OS development work today, is that I have extreme difficulties to write dirty code now and fix it later, as I do on other projects. I must check all alternatives I may think of first. That’s because I have a frightening obsession of cleanness and doing things right the first time, and extreme difficulties to tell myself “hey, it’s okay, I just can’t tell if a solution is better as long as I don’t have seen how it compares on real-world use cases”. And by doing so, I make the time before those real-world use cases are available longer. This is where I’m ready to believe that perfectionism can become a disease.
On the other hand, this is the first time I ever write a kernel. So I’d better be extremely careful. If I stick a design defect deep in my OS and only discover it much later, I may have to break several things built on top of the defect while trying to fix it. So better doing it right the first time… And so on. There are justifications for this behavior sadly.
Hell… What a complicated and poorly written post just to say that I did nothing ! I really feel angry about myself right now. Sleeping more is probably the answer.