On Sunday 19 June 2011 05:39, Timo Teräs wrote:
> On 06/19/2011 05:54 AM, Denys Vlasenko wrote:
> > On Saturday 18 June 2011 17:56, Timo Teräs wrote:
> >> Speeds up considerably config file parsing.
> >>
> >> Signed-off-by: Timo Teräs <[email protected]>
> > 
> > # time ./z ./busybox_old 2>/dev/null
> > real    0m5.337s
> > user    0m4.655s
> > sys     0m0.393s
> > 
> > # time ./z ./busybox 2>/dev/null
> > real    0m5.150s
> > user    0m4.291s
> > sys     0m0.379s
> > 
> > Again, some win, but it's small. However, I use uclibc configured without 
> > threads.
> 
> For both patches 1 and 3.
> 
> The speed up depends on the size of your modules.dep and the amount of
> aliases in /etc/modprobe.d.
> 
> I was testing with stock Ubuntu kernel modules data, and speed up was
> enough to justify the byte addition.

I just tested it again on Fedora 15, which has bigger modules.dep.
(My machine's modules.dep is 41k, F15's is 224k).

On both machines speedup is not so big. Hash seems to help more then getline:
on F15, it reduced run time from 19 to 16 seconds, while getline won
~0.5 sec only.

Don't take me wrong, I'm not saying the patches are not good.
I am saying we need to figure out how much *each* patch speeds up
modprobe, and in what conditions (IOW: why you see big speedup,
and I see small one), so that we can document it in comments
and save some head scratching for future hackers.

Let's take a more detailed look.

How big is your modules.dep (bytes and lines)?

Can you send me your .config?

Can you send me timing results and bloatcheck for both patches?

How much speedup you get if you use getc_unlocked instead of getline
(see attached patch)?

-- 
vda
diff -ad -urpN busybox.8/include/libbb.h busybox.9/include/libbb.h
--- busybox.8/include/libbb.h	2011-06-19 02:45:14.000000000 +0200
+++ busybox.9/include/libbb.h	2011-06-19 05:03:57.000000000 +0200
@@ -160,6 +160,33 @@ int sysinfo(struct sysinfo* info);
 #endif
 
 
+/* Busybox does not use threads, we can speed up stdio */
+#ifndef getc_unlocked
+# define getc(stream) getc_unlocked(stream)
+#endif
+#ifndef getchar_unlocked
+# define getchar() getchar_unlocked()
+#endif
+#ifndef putc_unlocked
+# define putc(c, stream) putc_unlocked(c, stream)
+#endif
+#ifndef putchar_unlocked
+# define putchar(c) putchar_unlocked(c)
+#endif
+#ifndef fgetc_unlocked
+# define fgetc(stream) fgetc_unlocked(stream)
+#endif
+#ifndef fputc_unlocked
+# define fputc(c, stream) fputc_unlocked(c, stream)
+#endif
+#ifndef fgets_unlocked
+# define fgets(s, n, stream) fgets_unlocked(s, n, stream)
+#endif
+#ifndef fputs_unlocked
+# define fputs(s, stream) fputs_unlocked(s, stream)
+#endif
+
+
 /* Make all declarations hidden (-fvisibility flag only affects definitions) */
 /* (don't include system headers after this until corresponding pop!) */
 PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to