shell, perl, performance, parallelism, profiling, etc. (was: Upgrade guidance)

Michael Pelletier mvpel at hushmail.com
Tue Oct 21 14:36:29 EDT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 21 Oct 2008 13:56:21 -0400 Ben Scott <dragonhawk at gmail.com>
wrote:
>On Tue, Oct 21, 2008 at 12:05 PM, Bill McGonigle
><bill at bfccomputing.com> wrote:
>> Efficiency is surprisingly worse with bash/comm, I don't get
>why:
>
>  *Very* interesting.  I don't get anywhere near the same results.
>I'm seeing the following as typical:
>
>== Shell tools ==
>real    0m4.650s
>user    0m0.002s
>sys     0m0.005s
>
>== Perl ==
>real    0m6.915s
>user    0m6.135s
>sys     0m0.642s
>
>  I guess my home PC must be faster than your testbed in general
>(seconds vs minutes), but shell tools are faster for me, vs Perl
>for you. Also, I don't get how the "user" counter can both be so
>low for the shell tools, but so high for Perl.  Is it because the
>shell tools fork, and children aren't counted?

An important thing to remember with Perl is that the Perl
interpreter must be loaded before the script can proceed.  This may
explain the difference in your case, Ben.

On UNIX/Linux, this issue is typically addressed by setting the
sticky bit on the Perl executable to cause the OS to leave it in
memory after execution is complete.

Try doing that and see if the numbers change at all.  I'm frankly
shocked to see a shell script operating faster than a Perl script
in any case, but maybe Bash is more clever than I'm used to.

     -Michael Pelletier.
-----BEGIN PGP SIGNATURE-----
Charset: UTF8
Version: Hush 3.0
Note: This signature can be verified at https://www.hushtools.com/verify

wpwEAQECAAYFAkj+IS0ACgkQYyfSpvdnzUn/vgP/TnRPSKq/jQL+Qb7KoX8NnQgASZNm
CcUIoi7M6h9aPyxJte1bvhu+laI+yNdYdqRWKnyTB4ajmptSP0ozZ4Ak3GXppyH6kX7l
02bEjhsS3KG5mj/Q1yGjsnE3fFnnPFzUprJ75RPk/1H9uAgxSoF9k3yCQXugPvNbQHLt
kL3OUtY=
=7NEf
-----END PGP SIGNATURE-----



More information about the gnhlug-discuss mailing list