On Thu, May 2, 2013 at 12:43 PM, Sasha Pachev <[email protected]> wrote:
> Bryan: > > Are you sure about that? Explain this: > > > bash-4.1$ time java LineReverse /usr/share/dict/words > /dev/null > > real 0m1.413s > user 0m1.634s > sys 0m0.270s > > bash-4.1$ time ./strrev /usr/share/dict/words > /dev/null > > real 0m0.055s > user 0m0.052s > sys 0m0.003s > > bash-4.1$ time java LineReverse words3 > /dev/null > > real 0m3.966s > user 0m3.570s > sys 0m0.953s > > bash-4.1$ time ./strrev words3 > /dev/null > > real 0m0.171s > user 0m0.162s > sys 0m0.009s > > bash-4.1$ time java LineReverse words6 > /dev/null > > real 0m7.151s > user 0m6.157s > sys 0m1.535s > > bash-4.1$ time ./strrev words6 > /dev/null > > real 0m0.326s > user 0m0.312s > sys 0m0.014s > I think the inefficiency we're seeing is that Java is reading and writing everything in unicode -- a burden that the C and Perl implementations don't have to worry about. Still, these execution times seem slow. What's the output of "java --version" on your box? -Bryan /* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
