Spun out of the "C++ 11 to Golang convertor" thread...
On Mon, Jan 7, 2019 at 12:27 AM Eric S. Raymond <e...@thyrsus.com> wrote: > Perry and I have two different target languages in mind. Perry's > target language is basically a repaired C - type-safe, almost > upward-compatible. He and I have the same strategic goal - draining > the swamp of old, leaky C code - we're just betting on slightly > different ways to do it. We intend to cooperate as much as possible. This is drifting quite off-topic, but I would expect transpiling C to Go would result in something slower than the original, especially if it involves a lot of low-level, slice-of-bytes processing. Faster is obviously easier to sell than slower. Go is memory-safe, but that entails e.g. runtime bounds checking. Any individual bounds check might be cheap, measured in nanos, but for e.g. image decoding, a per pixel bounds check multiplied by a megapixel image (a 'low-res' photo, by today's standards) means that nanos become millis. Reasonable people can disagree, but I favor rewriting over transpilation, for draining that swamp. https://github.com/google/wuffs is a new, memory-safe programming language and a written-from-scratch library of various file formats. Runtime performance is a special concern: there are no implicit (runtime) bounds checks. Unlike Go, bounds checks have to be explicit, which means that programs can eliminate them from the object code by, well, eliminating them from the source code. Here are some work-in-progress microbenchmarks (the output of "wuffs bench" piped to "benchstat") of Wuffs' GIF decoder versus my Debian system's stock giflib 5.1.4, a library that you might be familiar with :-). The giflib library is called "mimic" here, since the correctness tests check that Wuffs mimics (produces the same output as) giflib. The short story is that Wuffs is around 2x to 6x faster than giflib, and giflib is, say, 1.5x faster than Go's image/gif, a package that I'm familiar with :-). ---- wuffs_gif_decode_1k_bw/clang 245MB/s ± 1% wuffs_gif_decode_1k_color/clang 140MB/s ± 1% wuffs_gif_decode_10k_indexed/clang 183MB/s ± 1% wuffs_gif_decode_100k_artificial/clang 530MB/s ± 1% wuffs_gif_decode_100k_realistic/clang 212MB/s ± 0% wuffs_gif_decode_1000k/clang 216MB/s ± 0% wuffs_gif_decode_anim_screencap/clang 1.09GB/s ± 0% wuffs_gif_decode_1k_bw/gcc 265MB/s ± 1% wuffs_gif_decode_1k_color/gcc 147MB/s ± 1% wuffs_gif_decode_10k_indexed/gcc 187MB/s ± 1% wuffs_gif_decode_100k_artificial/gcc 517MB/s ± 1% wuffs_gif_decode_100k_realistic/gcc 213MB/s ± 1% wuffs_gif_decode_1000k/gcc 217MB/s ± 1% wuffs_gif_decode_anim_screencap/gcc 1.08GB/s ± 1% mimic_gif_decode_1k_bw 141MB/s ± 1% mimic_gif_decode_1k_color 76.2MB/s ± 1% mimic_gif_decode_10k_indexed 94.8MB/s ± 0% mimic_gif_decode_100k_artificial 155MB/s ± 0% mimic_gif_decode_100k_realistic 95.9MB/s ± 0% mimic_gif_decode_1000k 98.1MB/s ± 0% mimic_gif_decode_anim_screencap 176MB/s ± 0% ---- To reproduce these numbers: git clone https://github.com/google/wuffs.git cd wuffs gcc -O3 -std=c99 -Wall -Werror test/c/std/gif.c -DWUFFS_MIMIC -lgif ./a.out -bench Optionally pipe that final command to "benchstat /dev/stdin", installed by "go get golang.org/x/perf/cmd/benchstat". Wuffs' documentation is lagging the implementation by many months. Sorry. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.