PDA

View Full Version : Question about writing perl subroutines in c



2weird
January 6th, 2009, 10:11 PM
I have read about writing perl subroutines in c and plan to try it out.
One question i need to ask is, by writing the subroutines in c does that mean my sub routines will run with c like efficiency?

jimi_hendrix
January 6th, 2009, 11:05 PM
try it out...make a routine that does:

get current time

do large amount of math

get current time

print difference in time

then run it in C and run it in Perl

snova
January 7th, 2009, 12:38 AM
I have read about writing perl subroutines in c and plan to try it out.
One question i need to ask is, by writing the subroutines in c does that mean my sub routines will run with c like efficiency?

If you write it in C, you get the speed of C...

Tempered by any Perl code you call, of course. But that may be negligible.

2weird
January 7th, 2009, 08:13 PM
For those who would like to know: I have done some tests and it turns out that on first time run c code takes longer than perl. On the Second time it runs faster.