Thursday, 28 November 2013

Every now and then one must emerge to let the world know one's alive


1. The puzzle mentioned in my previous post is solved. I've increased the +/- 4M lines to 16M, and the difference from pass-by-value to pass-by-reference increased to a little over 1 min. So, there's a difference, but it's irrelevant. This was also a good example of something I've read before, that the compiler takes certain liberties when optimizing classes it knows - such as making calls directly to the implementation of standard containers, instead of using the usual interface. In this case, instead of using std map's copy ctor, it directly invoked the underlying red-black tree copy implementation.

So, the song remains the same - measure first, and optimize only what's required.

2. I've upgraded to Qt Creator 2.8.1/Qt 5.1.1, and I've rebuilt all the libs to work with mingw's gcc 4.8. I've also created scripts to automate building boost and ICU. While developing the boost script (in perl), I've come across a peculiar problem, but this time I've decided to work around it (half the work is in perl, the other half in a DOS batch script), instead of trying to figure out the cause. Life's too short, and all that jazz...

3. Watching Alex Stepanov's A9 lectures made me realize I was familiar only with C++'s OO paradigm, and that I had to diversify. So, I've began approaching my designs in a different fashion, applying generic programming whenever possible and resisting the urge to turn almost everything into an object. I'll address this in future posts, hopefully.

4. My libssh2 + boost asio work has been deployed. Not in the grandiose manner I envisioned, filled with pools of ssh connections and a multitude of threads, but in a more modest setting - a command line utility that reads a few files and runs a list of commands on a remote server. It's indeed a humble beginning, but it has already proved its success, and it will allow me another shot at something that got me stuck - how to apply logging to it (actually, for this utility, I #defined out all logging, because I wasn't happy with it).

I believe I got stuck because I tried to solve the problem of applying logging to reusable code, which is more complex than the problem I'll address now - how to apply logging from the point of view of an app (i.e., the code the uses the reusable code). I hope this different - and simpler - point of view will prove more productive.