This doesn't surprise me in the least. Seeing a speedup of a factor of 200 or so isn't unusual when turning an algorithm from perl to C. Like it or not, perl has a fair number of inefficiencies built into it, and some of the things it requires to happen, like operator overloading and proper tie behaviour, have unavoidable overhead.
C's a lot more limited, and as such can make more assumptions at compile time, which can generate better code, and that's just fine. (Plus, of course, there's been far more work on any C compiler's optimizer than on perl's optimizer, which can make a pretty darned big difference)
Really does look like you did the appropriate thing--used perl for a fast knock-together project, and moved to a faster language when it turned out to be necessary. FWIW, I don't think you'd have seen much, if any, speed win from going with Java. The cost of moving to Java from perl would've been about the same as moving to C, and C's definitely much faster than Java...
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.