Joined devRant on 2/13/2018
Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
Recently had to implement some microbenchmarks for a project. First time I ran them, I thought they had gone stuck. It turned out they weren't, but the processing took forever.
Some smaller benchmarks revealed that runtime was not scaling linearly with the input size as one would expect for the problem. It turned out that code was iterating over the input to find corresponding entries in the output.
We changed the processing so that it creates the output in the same order as the input and just compare entries at the same position. With that we were able to cut runtime from a few hours to a few seconds.
If you call the API function to lookup the name of a service it expects a buffer and the size of the buffer.
If the supplied size is smaller than the service name it returns the number of characters (excluding the null-terminator) of the service name.
You can allocate a buffer for the service name and call the function again to receive the service name.
Except now Windows wants to know the size of the buffer including null terminators.
That took me a moment to figure out.
A friend was writing a small game. He asked me to take a look at why the FPS where horrible although he was only drawing the background each tick.
He had about 10 different images that were used to draw the background tiles. Each iteration of the game loop he would loop over all tile positions, determine which image to use for this tile, load the image from disk and create a new tile using the image, which then would be drawn and forgot.4