2009-11-02 15:57:29 UTC
Here is the patch:
--- C/Types.h
+++ C/Types.h
@@ -104,5 +104,10 @@
#define MY_CDECL
#define MY_STD_CALL
+
+#if __GNUC__ && __i386__
+#define MY_FAST_CALL __attribute__((__fastcall__, __noinline__))
+#else
#define MY_FAST_CALL
+#endif
#endif
And here are the benchmark results from a Core2 Duo:
~$ p7zip_9.04/bin/7zr b -mmt1
7-Zip (A) 9.04 beta Copyright (c) 1999-2009 Igor Pavlov 2009-05-30
p7zip Version 9.04 (locale=C,Utf16=off,HugeFiles=on,2 CPUs)
RAM size: 2000 MB, # CPU hardware threads: 2
RAM usage: 419 MB, # Benchmark threads: 1
Dict Compressing | Decompressing
Speed Usage R/U Rating | Speed Usage R/U Rating
KB/s % MIPS MIPS | KB/s % MIPS MIPS
22: 2004 100 1945 1950 | 21217 100 1917 1915
23: 1916 100 1956 1953 | 21019 100 1921 1924
24: 1847 100 1984 1986 | 20744 100 1927 1925
25: 1777 100 2029 2029 | 20440 100 1922 1922
----------------------------------------------------------------
Avr: 100 1979 1979 100 1922 1921
Tot: 100 1950 1950
~$ p7zip_9.04-fastcall/bin/7zr b -mmt1
7-Zip (A) 9.04 beta Copyright (c) 1999-2009 Igor Pavlov 2009-05-30
p7zip Version 9.04 (locale=C,Utf16=off,HugeFiles=on,2 CPUs)
RAM size: 2000 MB, # CPU hardware threads: 2
RAM usage: 419 MB, # Benchmark threads: 1
Dict Compressing | Decompressing
Speed Usage R/U Rating | Speed Usage R/U Rating
KB/s % MIPS MIPS | KB/s % MIPS MIPS
22: 1995 100 1945 1941 | 22336 100 2014 2016
23: 1913 100 1947 1949 | 22138 100 2024 2027
24: 1842 100 1982 1980 | 21840 100 2024 2026
25: 1773 100 2024 2024 | 21516 100 2022 2023
----------------------------------------------------------------
Avr: 100 1974 1974 100 2021 2023
Tot: 100 1998 1998
Really nice for decompression :)
Since there is no portable option in GCC (at least AFAIK), using fastcall with all functions would require patching every function.