Guest User

Untitled

a guest
Jun 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. 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.
  2.  
  3. // C++ code # Perl code
  4.  
  5. wPerlScalar r = 0; $r = 0;
  6.  
  7. for (int i = 0; i < 100000; ++i) for ($i = 0; $i < 100_000; ++$i)
  8. { {
  9. r = r + i; $r = $r + $i;
  10. } }
Add Comment
Please, Sign In to add comment