Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- At first glance, you may think the following C++ code runs much faster than the equivalent Perl code. You'd be wrong. The Perl code is actually faster. On the Sun Ultra 2, the Perl code runs 10% faster than the C++ code.
- // C++ code # Perl code
- wPerlScalar r = 0; $r = 0;
- for (int i = 0; i < 100000; ++i) for ($i = 0; $i < 100_000; ++$i)
- { {
- r = r + i; $r = $r + $i;
- } }
Add Comment
Please, Sign In to add comment