Another Micro-Optimization Provides Useless Results

One of the things to remember about performance optimizations performed in isolation is that their results are rarely representative of real-world performance results. This article outlines the “findings” of the students at a couple of Canadian universities, and comes to the conclusion that string concatenation in memory is slower than writing the same total number of bytes to disk, one after the other.

String concatenation is a slow and CPU-heavy operation. It drastically affects Micro-Optimization testing when both algorithms do not utilize it.

If you don’t immediately see the issue with the algorithm in which the study is utilizing, it will become apparent shortly. You see, when writing to disk, the students were simply writing X bytes at a time to a location on the disk, moving over, writing more. However, when doing it all in memory, they were implementing string concatenatation. These two operations require vastly different amounts of CPU cycles to complete, adding a variable to the performance equation that was not considered in the evaluation.

If the students were actually comparing disk performance versus memory performance, they should have first created a ramdisk and ran the same code against the ramdisk and the normal filesystem on a hard drive or ssd. By creating the ramdisk, you are able to write to a reserved section of memory using the same codepaths in Java and Python that are used for writing to disk, the only difference being the destination and the drivers for that destination, which is as close as possible to comparing two different storage media.

comments powered by Disqus

Related Posts

Stop Wanting and Start Choosing

I am used to hearing people use phrases like “I want to be able to do X thing” or “I want to have X position at my company” when people are talking in generalities about their goals. I tend to do it often as well, especially when using “self-talk” to attempt to work on internal goals and desires. However, when reading a book from Paul Tough, How Children Succeed, one of the quotes that he references from Jonathan Rowson, a Scottish chess grand master who had written about the importance of emotion and psychology in chess success.

Read More

Avoid SiteCatalyst's useForcedLinkTracking and target="_blank"

All sites rely upon some third party analytics software to track at the very least the number of visitors to a site. Many sites use Google Analytics, which provide much more information that just the number of visitors. Another option that some of the bigger sites use is Adobe Analytics, aka SiteCatalyst to enable more custom tracking options that are not evident through the Google Analytics interface. One feature of SiteCatalyst is that it allows you to set an option useForcedLinkTracking that will track every link on your site for clicks whether or not you have setup custom tracking for the links or not.

Read More

Top 5 Reasons To Test Your Website Across Browsers

I would hope that those of you taking the time to read this posting would have some idea of why you should perform some level of testing of the software and websites you create. However, I am keenly aware that some management types don’t always understand the importance of testing until an untested “feature” appears in the wild, frustrating all that run across it. Ensure Cross Browser Compatibility- Unless you develop a website for internal usage only, where you are able to successfully restrict users to a specific version of a specific browser, Cross Browser Compatibility ensures your site functions well for the greatest number of users.

Read More