NanXiao / free

free command for OpenBSD.
BSD 3-Clause "New" or "Revised" License
26 stars 8 forks source link

Many cumulative fixups. #8

Closed ibara closed 2 years ago

ibara commented 2 years ago

Hi Nan --

This PR cleans up the latest commit:

Thanks. Please consider making a new release soon with these changes so I can commit it to the OpenBSD ports tree.

ibara commented 2 years ago

Hi again --

I added a second commit. This second commit marks the output() function as static. This allows clang to make some additional optimizations that have significant size improvements.

Without static:

text    data    bss     dec     hex
3955    552     480     4987    137b

With static:

text    data    bss     dec     hex
3779    544     480     4803    12c3

Which is nearly a 4% savings in final binary size.

ibara commented 2 years ago

A third fix: All those global variables do not need to be globals.

This brings the size of free down even more:

text    data    bss     dec     hex
3723    544     85      4352    1100

Which is nearly a 13% binary size reduction.

NanXiao commented 2 years ago

@ibara Thanks very much for your hard work! I have created v1.1 release, and please check it when you are free, thanks very much again for your time and help!