Is writing a bad C++ program better than writing it in Perl?
March 12, 2008 2:13 PM Subscribe
Does compiled vs. interpreted code make a difference if the structure of the algorithm is the same (ie, ugly and slow)? Should I take the extra effort of writing a small program in C++ or just do it in Perl...?
posted by omair to computers & internet (17 answers total) 3 users marked this as a favorite
I need to write a script that will search for a pattern of characters (let's say 5 letters, followed by a dash, followed by 3 letters -- or something like that) in EVERY file (of certain types) on the computer.
Whether I write it in Perl or in C++, it would look the same, I think.
I would create a list of all the applicable files on the computer and loop through them one by one. Then, for each file, I would get each line and search it for my pattern. O(n^2), right?
This seems to be pretty easy to do in Perl, which I have used a lot, but more of a headache to getting it working in C++. However, the only reason I am leaning towards C++ is because this script has to run on at least 100 machines...so something that is faster would be better.
But if the algorithm is fundamentally the same for both, does it make a difference? Should I just do it in Perl? What about things like memory management and the computer resources being all used up making the machine unusable while the program/script is running? (i.e., these other things besides the actual running time of the program?)
Thank you for your insight into this.