[PATCH 0/1] applet_tables: make number of stored offsets depend on NUM_APPLETS

Ron Yorston rmy at pobox.com
Sat Apr 2 16:08:29 UTC 2016


Denys Vlasenko wrote:
>Yes, that is too simplistic and not optimal. I propose that we select
>KNOWN_APPNAME_OFFSETS with finer granularity:
>
>#if NUM_APPLETS > 128
>// With 129 applets we do two linear searches, with 1..7 strcmp's in
>the first one
>// and 1..16 strcmp's in the second. With 256 apps, second search does
>1..32 strcmp's.
>#  define KNOWN_APPNAME_OFFSETS 8
>#elif NUM_APPLETS > 32
>#  define KNOWN_APPNAME_OFFSETS 4
>#else
>// Save code size: do not compile speedup code at all, do only one
>linear search.
>#  define KNOWN_APPNAME_OFFSETS 0
>#endof

That would give:

 applets     cycles    bloat
    13       224.07       0
    28       478.79       0
    48       318.94      90
    72       442.22      90
    96       554.67      90
   133       520.57     109
   172       612.75     109
   214       764.11     109
   281       941.46     109
   364      1162.98     107
   494      1468.60     107

I'm OK with that.

Ron


More information about the busybox mailing list