So I’ve been working on this app for Dr. M–the UV/VIS number cruncher. I’ve got it working and all that good stuff, but I need to redesign the GUI, and that gets saved for tomorrow, with all the joys of fighting with Visual C++. The big thing was getting it working, and quickly, behind the scenes.
I ran into an interesting dilemma where the app ran so slowly it was unbearable. It took twenty to thirty minutes to crunch about seventy thousand pairs of wavelength/absorbance data (a 1.3 MB comma delimited file). It took the old DOS version about a minute. It obviously wasn’t any of the algorithms Mr. Dr. M wrote, since the DOS version worked fine.
Two hours and much research on file streams in Windows later (my initial suspicion was that using the old iostream class to perform file IO in Windows was killing the app–but again, the DOS version does), I found two lines where I used an ass-backwards, convoluted way of clearing two vectors and inserting data into them again. And those two clearing statements are executed for every single sample set (26 * 4.5 = 117), and the two statements to assign the data are executed for every single pair of wavelength/absorbance data. See about about 70,000 pairs being in this particular file.
A quick fix to the four lines in question gave me a sexy fast app. It’s about damn time. I love this stuff, though…