Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A perl version' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A perl version
Authored by: adamjacobmuller on Jun 21, '03 07:19:19PM

the perl version is much faster too!
-------

case-insensitive bash&awk&tr version

bash-2.05a# time pidof httpd
337 348 385

real 0m0.169s
user 0m0.020s
sys 0m0.090s
----------------------------
bash&awk&tr case sensitive
bash-2.05a# time pidof httpd
337 348 385

real 0m0.094s
user 0m0.020s
sys 0m0.040s
----------------------------
perl case insensitive

bash-2.05a# time ./perl-pidof httpd
337 348 385

real 0m0.033s
user 0m0.000s
sys 0m0.030s
----------------------------
perl case sensitive
bash-2.05a# time ./perl-pidof-cs httpd
337 348 385

real 0m0.033s
user 0m0.010s
sys 0m0.020s

the verdict? pidof is fastest with the perl version which doesnt care if you want case sensitive or case insensitive output, what's my /bin/pidof now?
rselph's perl pidof function, case sensitive.



[ Reply to This | # ]