improved last

Bernhard Fischer rep.dot.nop at gmail.com
Wed May 21 15:34:57 PDT 2008


On Wed, May 21, 2008 at 07:44:49PM +0200, Denys Vlasenko wrote:
>On Wednesday 21 May 2008 17:59, Cristian Ionescu-Idbohrn wrote:
>> On Wed, 21 May 2008, Denys Vlasenko wrote:
>> 
>> > On Wednesday 21 May 2008 01:04, Cristian Ionescu-Idbohrn wrote:
>> > > Please consider for inclusion this optional (and yes, bigger)
>> > > variation of 'last', which a collegue of mine wrote (see copyright
>> > > mote), as we badly need something like this at work.

What exactly do you need that our current version does not do?

I'm attaching two patches against the current (small) last(1):
    668	      0	      0	    668	    29c	miscutils/last.o.oorig
    550	      0	      0	    550	    226	miscutils/last.o.01
    621	      0	      0	    621	    26d	miscutils/last.o.02

I like the .01 version best (just wipe everything with "pos", so make
that one patch above), but the .02 does the output like the big last(1)
that comes with my distro, i.e. fifo.

>> > > The output is identical with sysvinit 'last' at an extra cost of
>> > > 1238 bytes.
>> > >
>> > > function                                             old     new   delta
>> > > last_main                                            448    1084    +636
>> > > show_entry                                             -     355    +355
>> > > .rodata                                           120946  121080    +134
>> > > add_entry                                              -      45     +45
>> > > packed_usage                                       17924   17956     +32
>> > > static.ret                                             -       8      +8
>> > > static.pos                                             -       8      +8
>> > > start_time                                             -       4      +4
>> > > show_wide                                              -       4      +4
>> > > list                                                 348     352      +4
>> > > filename                                               -       4      +4
>> > > boot_down                                              -       4      +4
>> > > ------------------------------------------------------------------------------
>> > > (add/remove: 8/0 grow/shrink: 4/0 up/down: 1238/0)           Total: 1238 bytes

1700 bytes sounds like a lot for what it advertises to do.  Again, what
do you need?

>> >
>> > Can you work on it a bit more?
>> >
>> > static int boot_down = 0;
>> >
>> > Completely wasted four bytes. grep for it.
>> 
>> Alright, I did that and managed to save 2 bytes.  I also tested to
>> remove most of the other static variables.  That led to increased
>> size.  If you think the 2 bytes lighter version of the applet is
>> interesting, just let me know.
>
>This is a 10-minute worth of shrinking:
>
>function                                             old     new   delta
>show_entry                                           355     359      +4
>boot_down                                              4       1      -3
>show_wide                                              4       -      -4
>filename                                               4       -      -4
>last_main                                           1084    1030     -54
>------------------------------------------------------------------------------
>(add/remove: 0/2 grow/shrink: 1/2 up/down: 4/-65)             Total: -61 bytes
>
># size last-org.o last.o
>   text    data     bss     dec     hex filename
>   1730      12      24    1766     6e6 last-org.o
>   1680       8      17    1705     6a9 last.o
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox.shrink-last-a-bit.02.patch
Type: text/x-diff
Size: 3196 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20080522/38d43131/attachment.patch 


More information about the busybox mailing list