bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why bash is not so efficient as cron?


From: mishabear
Subject: Why bash is not so efficient as cron?
Date: Fri, 2 Mar 2007 18:48:57 +0800

What I have done in this test is:
1. Install a job in cron. The job is simple: grep a string in a very big
file, which is a concatenation of rfcs;
2. After cron finished the job, cat the result and running time;
3. Execute the very same job under bash, then cat the result and running
time;
4. The comparison of results shows that cron is more efficient than bash. I
can't find a reason to explain this.
5. I hope bash can do a job as efficient as cron.

[root@localhost work]# date
Fri Mar  2 18:39:39 CST 2007
[root@localhost work]# crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.11170 installed on Fri Mar  2 18:37:20 2007)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
38 18 * * * date > "/home/work/tm.log" ; grep comment
/home/work/a_big_txt.file | wc -l > "/home/work/ln.cnt"; date >>
"/home/work/tm.log"

[root@localhost work]# cat tm.log
Fri Mar  2 18:38:00 CST 2007
Fri Mar  2 18:38:00 CST 2007
[root@localhost work]# cat ln.cnt
  5004
[root@localhost work]# date > "/home/work/tm.log" ; grep comment
/home/work/a_big_txt.file | wc -l > "/home/work/ln.cnt"; date >>
"/home/work/tm.log"
[root@localhost work]# cat tm.log
Fri Mar  2 18:40:09 CST 2007
Fri Mar  2 18:40:44 CST 2007
[root@localhost work]# cat ln.cnt
  5004
[root@localhost work]# uname -a
Linux localhost.localdomain 2.4.20-8smp #1 SMP Thu Mar 13 17:45:54 EST 2003
i686 i686 i386 GNU/Linux
[root@localhost work]# cat /etc/issue
Red Hat Linux release 9 (Shrike)
Kernel \r on an \m

[root@localhost work]# ls -la a_big_txt.file
-rw-r--r--    1 root     root     226942520 Feb 27 14:01 a_big_txt.file
[root@localhost work]# wc -l a_big_txt.file
5966449 a_big_txt.file
[root@localhost work]#


reply via email to

[Prev in Thread] Current Thread [Next in Thread]