Friday, February 9, 2018

Everything is so fast

I just noticed that I've not posted here for way too long! Sorry, but life does seem to eat up time.

I've been wondering lately if it'd be worthwhile to do some major modifications to MMA to permit multiple files on the command line. In the back of my mind a little voice was saying that it'd run faster if we only did the python initialization stuff once.

Well, time to test it! And, the little voice was right. But, to such a small degree that I've decided that the added complications really aren't going to be worthwhile.

My test was simple: I surrounded the call to the main parser and MIDI generators with timer. Then, I ran MMA from the command a number of times with different sized files using the Linux time command.

The result? Most files took a total of about a tenth of a second to read, process and compile (my range was 0.080 to 0.188 seconds). Not very long. And, the time to initialize seems to be around 0.050 seconds. So, on a large source file we might reduce the total processing time from 0.200 seconds to 0.150 seconds. And, this saving was applied to, say, 100 files we'd save a grand total of 5 seconds.

I just did a test of my personal files. 1171 MMA files compile on my computer (Intel I5-4570 @ 3.20Ghz) in 2:35 minutes. About .132 per file. And, if we applied the 0.05 saving to each file we'd save less than a minute. Actually, much less since there would be more processing time in parsing the very long command line and resetting all of the necessary variables, clearing out memory, etc.

I think we just wasted more time just doing/reading this blog than we'd ever save. If you need to process files more quickly just get a faster CPU.

So, unless someone presents a compelling reason to change MMA's "one file at a time" behavior I am going to leave this idea alone.




No comments:

Post a Comment

Mea Culpa

Isn't it just plain annoying when you end up wasting most of an afternoon trying to find a bug in your code when there is no bug? Just h...