Perl: print $local_process_var, " ", &gen_pg_template(), "\n"
Python: print local_process_var, " ", gen_pg_template()
Java: System.out.println( timestamp + " " + genPgTemplate() );
I'm not sure, but I think the Perl/Python code sends the strings as arguments to print that will just output them directly. In Java you will concatenate 3 strings before sending it to "print". This adds some extra CPU usage that the other versions don't have
Still, I could modify the scripting output lines to bring them down to Java's level :-)
Interesting comment about the date formatter. I might put in something some time to compare the relative time spent in formatting vs the other concatenation. I suppose I'd be grateful if somebody made a fork with versions showing the split of time between those steps.
Most business app work is string manipulation. If you think Ruby is slow, look at the timings for "sequential" operation in the table on this page (yes, it's my site):
http://roboprogs.com/devel/2009.12.html
If you think that I have badly blundered in my methodology, get the benchmark code, fiddle with it, and run it on your own hardware:
https://github.com/roboprog/mp_bench
FYI: I'm not trying to say that "Ruby is the most awesomest language, like ever, d00dz!!!". I like different tools for different jobs. I'm just tired of seeing people judge implementation speeds based on bit twiddling benchmarks, rather than stuff that at least churns through a large number of strings, if not other object types, and does some I/O.