Nigel Tao
00d5e35865
floatconv: optimize parse_number_f64 fallback
...
The time taken running script/manual-test-parse-number-f64.cc on the
parse-number-fxx-test-data suite falls from 3.565s to 2.491s (a 1.43x
ratio; the inverse is 0.70 = 100% - 30%).
Fixes #113
2023-04-08 14:56:32 +10:00
Nigel Tao
4d4c3c4c3c
floatconv: tweak Simple Decimal Conversion
...
This tweaks the code and comments added in commit 36d7748e "Merge pull
request #90 from sarastro-nl/improvement/optimize-SDC" and commit
d46220ca "optimize SDC". Both of those two commit messages are short but
see the discussion re algorithmic changes on PR 87 (yes, 87, not 90):
https://github.com/google/wuffs/pull/87
Also run clang-format.
Also update doc/changelog.md
Compared to before commit d46220ca "optimize SDC", when running
script/manual-test-parse-number-f64.cc and disabling both the
etc__parse_number_f64_eisel_lemire function and the "If both man and
(10 ** exp10) are exactly representable by a double" fast path, the
tests still pass but the number of etc__high_prec_dec__small_lshift and
etc__high_prec_dec__small_rshift calls drop:
Function Before After Ratio
lshift 31174584 25762258 82.64% = 100% - 17.36%
rshift 21592604 20982502 97.17% = 100% - 2.83%
The time taken drops from 15.984s to 13.710s (85.77% = 100% - 14.23%).
To repeat, these are the improvements after disabling the Eisel-Lemire
and other fast paths. Simple Decimal Conversion is the rarely invoked
fallback parse_number_f64 algorithm. The practical improvement (with
Eisel-Lemire etc enabled) is smaller.
2023-02-04 14:48:25 +11:00
sarastro-nl
d46220ca00
optimize SDC
2022-11-21 22:10:19 +01:00
Nigel Tao
c226ed60f5
Use memcpy-based peeks and pokes on Microsoft C
...
I don't have a Windows machine readily available, but according to
https://godbolt.org/z/q4MfjzTPh and the https://imgur.com/UD5a7MF
profile mentioned in #72 , this could improve inner loop performance.
Updates #72
2022-06-12 17:18:49 +10:00
Nigel Tao
be047533e1
Add bounds check to wuffs_base__make_slice_uNN_ij
2022-05-23 11:07:31 +10:00
Nigel Tao
84ef91dda8
Tweak cgen for an_array[i .. j]
2022-05-17 00:00:25 +10:00
Nigel Tao
787ff21cc7
Let magic_number_guess_fourcc sniff compression
2022-05-13 11:01:28 +10:00
Nigel Tao
c82793a984
Tighten magic_number_guess_fourcc TGA heuristic
...
Prior to this commit, test/data/cbor-rfc-7049-examples.cbor was
incorrectly sniffed as TGA. /usr/bin/file did this too.
$ file test/data/cbor-rfc-7049-examples.cbor
test/data/cbor-rfc-7049-examples.cbor: Targa image data - Map 59395 x 26
x 15 +6169 +6500 - 2-bit alpha - interleave "@\033"
Updates #67
2022-01-15 14:32:51 +11:00
Nigel Tao
792d05bd9c
Have magic_number_guess_fourcc use prefix_closed
2022-01-14 15:26:21 +11:00
Nigel Tao
e5ead0218e
Rename the magic-submodule "prefix" arguments
2022-01-14 15:16:20 +11:00
Nigel Tao
f0412122be
Add magic_number_guess_fourcc prefix_closed arg
2022-01-14 15:12:14 +11:00
Nigel Tao
546af5a7c3
Let magic_number_guess_fourcc sniff TGA
...
Updates #67
2022-01-14 14:40:58 +11:00
Nigel Tao
b64b2ff09a
Tighten magic_number_guess_fourcc ICO heuristic
2022-01-14 10:54:55 +11:00
Nigel Tao
dda01f1a77
Add WUFFS_BASE__FOURCC__QOI definition
2022-01-02 09:10:51 +11:00
Nigel Tao
4c04ac1127
Replace FOURCC__{WP8,WP8L} with FOURCC__WEBP
...
Fixes #61
2021-12-15 15:53:14 +11:00
Nigel Tao
ccbec18330
Re-order pixconv "Extract... components" variables
2021-11-21 21:20:59 +11:00
Nigel Tao
55cad41d6c
Have nonpremul SRC_OVER keep transparent red/blue
2021-11-21 21:16:10 +11:00
Nigel Tao
f5d6ce3797
Have etc__limited_copy_etc args match call sites
2021-11-20 22:34:25 +11:00
Nigel Tao
161e4730d8
Tweak default WUFFS_VERSION_PRE_RELEASE_LABEL
2021-11-18 19:18:34 +11:00
Nigel Tao
d40bf000a9
Rename wuffs_base__table_u8__row as etc__row_u32
2021-11-15 17:26:51 +11:00
Nigel Tao
962a515dd2
Add wuffs_base__table_u8__subtable_ij
2021-11-15 09:58:02 +11:00
Nigel Tao
f148f5c5b3
Make "// - etc" bullet point comments consistent
2021-11-05 16:50:38 +11:00
Nigel Tao
badce3ffa4
Tweak magic_number_guess_fourcc negative codes
2021-10-31 16:27:17 +11:00
Nigel Tao
8f9a4f40c2
Rename METADATA_RAW as METADATA_RAW_PASSTHROUGH
2021-10-31 15:17:46 +11:00
Nigel Tao
a9a6332be2
Have etc__magic_number_guess_fourcc find ICO
2021-10-22 15:51:44 +11:00
Nigel Tao
0460bfcd7a
Add FourCC comment
2021-10-17 23:18:58 +11:00
Nigel Tao
9437d1a265
Tighten magic number guessing for WBMP
2021-10-17 22:57:42 +11:00
Nigel Tao
e317f04bfd
Add defined(__clang__) to defined(__GNUC__) checks
2021-10-17 12:14:54 +11:00
Nigel Tao
ae9ca94501
Fix etc__more_information__metadata_parsed__chrm
2021-10-15 14:15:39 +11:00
Nigel Tao
ad1d983698
Add ETC__MORE_INFORMATION__FLAVOR__METADATA_PARSED
2021-10-14 17:17:11 +11:00
Nigel Tao
7f9f37ce5a
Have examples use WUFFS_CONFIG__STATIC_FUNCTIONS
...
Compile time:
$ time ./build-example.sh
Before: user 1m15.750s
After: user 0m50.343s
Binary size (excluding the statically linked example-toy-genlib):
$ ls -l gen/bin/example-* | awk '{print $5 " " $9}'
Before:
212624 gen/bin/example-cbor-to-json
284192 gen/bin/example-convert-to-nia
344744 gen/bin/example-crc32
184304 gen/bin/example-gifplayer
324952 gen/bin/example-imageviewer
209632 gen/bin/example-json-to-cbor
241432 gen/bin/example-jsonfindptrs
196320 gen/bin/example-jsonptr
309768 gen/bin/example-sdl-imageviewer
200704 gen/bin/example-zcat
After:
85280 gen/bin/example-cbor-to-json
242216 gen/bin/example-convert-to-nia
344744 gen/bin/example-crc32
53328 gen/bin/example-gifplayer
282840 gen/bin/example-imageviewer
95152 gen/bin/example-json-to-cbor
122720 gen/bin/example-jsonfindptrs
60448 gen/bin/example-jsonptr
267672 gen/bin/example-sdl-imageviewer
64792 gen/bin/example-zcat
Before total: 2508672
After total: 1619192
2021-10-04 12:35:32 +11:00
Nigel Tao
0d57d6a2e1
Add internal/cgen/base/README.md
2021-09-04 15:54:31 +10:00
Nigel Tao
a66a083e82
Have X86_FAMILY allow 32-bit x86, not just x86_64
...
Fixes #53
2021-08-22 22:37:48 +10:00
Nigel Tao
cb2e49ab09
Rename CPU arch macro s/X86_64/X86_FAMILY/
2021-08-22 22:23:49 +10:00
Nigel Tao
1d19157668
Remove After editing... run "go generate" lines
2021-08-22 12:57:39 +10:00
Nigel Tao
a86fd7fa79
Fix -Werror=sign-conversion in intconv-submodule.c
2021-08-15 13:48:04 +10:00
Nigel Tao
a83b5cabaf
Fix "-(int64_t)0x8000000000000000" undef behavior
...
Updates https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=37191
2021-08-15 12:39:01 +10:00
Nigel Tao
28a54baa19
Add io_bind history_position arg
2021-08-15 08:36:14 +10:00
Nigel Tao
3842c519c9
Delete the WUFFS_BASE__FALLTHROUGH macro
...
Getting it to work on various compilers has been more trouble than it's
worth. The previous commit ignores "-Wimplicit-fallthrough" instead.
2021-07-05 21:40:25 +10:00
Nigel Tao
fd90553a8f
Tweak the WUFFS_BASE__FALLTHROUGH macro
...
When compiling with "-Werror,-Wimplicit-fallthrough", commit c90cc7b6
tweaked WUFFS_BASE__FALLTHROUGH to work with newer clang compilers, when
defined(__cplusplus) is false, but inadvertently broke older clang
compilers, when __has_attribute(fallthrough) is false.
This commit reverts some of c90cc7b6 to handle more cases. The next two
commits will delete the WUFFS_BASE__FALLTHROUGH macro entirely and
render this commit redundant, as the whole business is proving more
trouble than it's worth. But it's checked into the commit history in
case somebody in the future wants to revive WUFFS_BASE__FALLTHROUGH.
2021-07-05 21:40:18 +10:00
Peter Kasting
56d5aa0907
Fix -Wunreachable-code-aggressive.
...
Bug: chromium:1066980
2021-06-29 12:00:03 -07:00
Nigel Tao
b9a10d051a
Fix -Werror=conversion in fundamental-public.h
2021-06-28 10:10:13 +10:00
Nigel Tao
7f93a94e7a
Tweak WUFFS_BASE__FALLTHROUGH comment
2021-06-28 10:07:01 +10:00
Nigel Tao
d8796aa6d9
Add wuffs_base__uxx__rotate_etc functions
2021-06-28 09:59:32 +10:00
Peter Kasting
c90cc7b657
Fix -Wimplicit-fallthrough for Clang.
...
WUFFS_BASE__FALLTHROUGH was not defined because the generated output is
C (so __cplusplus is never defined) and Clang was explicitly excluded
from the __attribute__ case (though it would have worked).
Instead test for the availability of the fallthrough attribute directly,
which should be more portable.
Bug: chromium:995993
2021-06-26 17:12:56 -07:00
Nigel Tao
91857f4c4b
Disable cpu_arch specific code for Native Client
2021-06-24 22:40:54 +10:00
Nigel Tao
08797bc713
Have "x86_avx2" require PCLMUL, POPCNT and SSE4.2
...
The std/crc32 benchmark numbers get worse. The benches still run AVX2
code, but it runs slower for an unknown reason. The std/gzip and std/png
benchmark numbers are mixed.
Still, it's cleaner for Wuffs' "x86_avx2" to be a superset of
"x86_sse42" (and apart from PCLMUL, they're now similar to Clang 12 and
GCC 11's "x86-64-v3" and "x86-64-v2" micro-architecture feature levels).
Maybe future compiler versions can claw back the std/crc32 performance.
On a mid-range x86_64 laptop (2016, Skylake):
name old speed new speed delta
wuffs_crc32_ieee_10k/clang9 8.07GB/s ± 0% 7.61GB/s ± 1% -5.72% (p=0.000 n=8+8)
wuffs_crc32_ieee_100k/clang9 11.0GB/s ± 1% 9.7GB/s ± 3% -11.45% (p=0.000 n=7+8)
wuffs_crc32_ieee_10k/gcc10 9.77GB/s ± 1% 7.72GB/s ± 1% -21.00% (p=0.000 n=10+9)
wuffs_crc32_ieee_100k/gcc10 12.7GB/s ± 2% 11.9GB/s ± 2% -5.84% (p=0.000 n=9+9)
wuffs_gzip_decode_10k/clang9 217MB/s ± 2% 221MB/s ± 0% +1.80% (p=0.000 n=10+8)
wuffs_gzip_decode_100k/clang9 280MB/s ± 1% 283MB/s ± 0% +1.38% (p=0.000 n=9+8)
wuffs_gzip_decode_10k/gcc10 215MB/s ± 1% 220MB/s ± 1% +2.52% (p=0.000 n=10+9)
wuffs_gzip_decode_100k/gcc10 272MB/s ± 0% 274MB/s ± 1% +0.74% (p=0.000 n=9+10)
wuffs_png_decode_image_19k_8bpp/clang9 136MB/s ± 0% 142MB/s ± 0% +3.95% (p=0.000 n=8+8)
wuffs_png_decode_image_40k_24bpp/clang9 171MB/s ± 1% 172MB/s ± 0% +0.84% (p=0.000 n=10+8)
wuffs_png_decode_image_77k_8bpp/clang9 492MB/s ± 3% 501MB/s ± 2% +1.88% (p=0.009 n=10+10)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang9 456MB/s ± 1% 461MB/s ± 1% +1.04% (p=0.000 n=9+9)
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang9 439MB/s ± 1% 440MB/s ± 3% ~ (p=0.173 n=8+10)
wuffs_png_decode_image_4002k_24bpp/clang9 172MB/s ± 1% 174MB/s ± 1% +1.29% (p=0.005 n=10+10)
wuffs_png_decode_image_19k_8bpp/gcc10 152MB/s ± 0% 149MB/s ± 1% -1.92% (p=0.000 n=9+9)
wuffs_png_decode_image_40k_24bpp/gcc10 184MB/s ± 0% 186MB/s ± 1% +1.37% (p=0.000 n=8+9)
wuffs_png_decode_image_77k_8bpp/gcc10 550MB/s ± 1% 542MB/s ± 2% -1.46% (p=0.000 n=10+10)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc10 473MB/s ± 1% 478MB/s ± 1% +1.23% (p=0.000 n=9+10)
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc10 453MB/s ± 1% 458MB/s ± 1% +0.91% (p=0.000 n=9+10)
wuffs_png_decode_image_4002k_24bpp/gcc10 185MB/s ± 2% 188MB/s ± 0% +1.82% (p=0.000 n=9+8)
2021-06-22 13:27:25 +10:00
Nigel Tao
b8f87debe3
Tweak wuffs_base__cpu_arch__have_foo_bar impl
2021-04-29 17:52:10 +10:00
Nigel Tao
8ccaf81e96
Fix s/bit_BMI2/bit_AVX2/ typo
2021-04-26 22:52:27 +10:00
Nigel Tao
5764f77913
Have std/png produce PIXEL_FORMAT__Y_16LE
...
Updates #46
2021-04-16 14:34:48 +10:00