in reply to perl printf vs C fprintf performance

The unix 'time' command is a very unreliable indicator of program performance. Included in those 4 wallclock seconds, for instance, are the time taken to start the perl interpreter; the time taken to read, parse, and compile your script; and the time taken to unload everything at the end, to name but a few.

You might want to look into Benchmark to see how your perl script is really performing. There are also several other great references available with a few moments googling, with more general benchmark advice.

  • Comment on Re: perl printf vs C fprintf performance

Replies are listed 'Best First'.
Re^2: perl printf vs C fprintf performance
by decnartne (Beadle) on Mar 14, 2005 at 20:05 UTC
    agreed - Benchmark probably would have been more accurate for times... I did actually use it in the original script to debug where my performance hit was. I found that the actual writing (the 8 or so printf statements) took ~8 seconds whereas the C app took ~2

    All that aside - I'm still somewhat at a loss (surprise!) as to why writing ~ 1M lines in a file w/ C fprintf is so much faster...

    decnartne ~ entranced