htop/linux
Explorer09 bf35921abb Optimize Strings_startWith()
Use strncmp() combined with a strlen() will give better performance
than a strstr in worst case. Especially when the match prefix is a
constant and not a variable.

While we are at it, replace the match() function in linux/Battery.c,
which uses a naive algorithm, with a macro that does better job by
utilizing Strings_startWith().

    $ gcc --version | head -n 1
    gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
    $ uname -m
    x86_64
    $ size htop.old htop.new
       text   data    bss    dec    hex filename
     137929  15112   3776 156817  26491 htop.old
     137784  15104   3776 156664  263f8 htop.new

Signed-off-by: Kang-Che Sung <explorer09 @ gmail.com>
2016-08-11 10:49:35 +08:00
..
Battery.c Optimize Strings_startWith() 2016-08-11 10:49:35 +08:00
Battery.h Optimize Strings_startWith() 2016-08-11 10:49:35 +08:00
IOPriority.c Files moved and added for supporting separate platforms. 2014-11-24 18:55:49 -02:00
IOPriority.h Files moved and added for supporting separate platforms. 2014-11-24 18:55:49 -02:00
IOPriorityPanel.c Simplify constructors. 2015-03-23 19:24:34 -03:00
IOPriorityPanel.h Files moved and added for supporting separate platforms. 2014-11-24 18:55:49 -02:00
LinuxCRT.c Fix spelling of "maintainer" 2016-01-02 12:11:26 -05:00
LinuxCRT.h Move platform-dependent parts of Linux battery meter. 2014-11-27 21:04:57 -02:00
LinuxProcess.c Catch invalid IO values due to no permissions. 2016-02-20 02:23:26 -02:00
LinuxProcess.h Make column width calculation dynamic. 2015-08-20 00:32:47 -03:00
LinuxProcessList.c Don't store invisible trailing whitespace 2016-06-15 12:41:50 -03:00
LinuxProcessList.h Introduce CLAMP macro. Unify all MIN(MAX(a,b),c) uses. 2016-01-15 20:26:01 +08:00
Platform.c Check for failure in allocations. 2016-02-02 15:53:02 +01:00
Platform.h Introduce CLAMP macro. Unify all MIN(MAX(a,b),c) uses. 2016-01-15 20:26:01 +08:00