Change the default -cformatter to dumbindent

A follow-up commit will remove the -cformatter flag entirely.

Formatting the generated C code is now a small fraction of where "wuffs
gen" spends its time.

----
$ # Before.
$ time wuffs gen > /dev/null
real	0m0.932s
user	0m0.837s
sys	0m0.187s

$ # After.
$ time wuffs gen > /dev/null
real	0m0.186s
user	0m0.170s
sys	0m0.069s

$ time wuffs gen -cformatter= > /dev/null
real	0m0.184s
user	0m0.170s
sys	0m0.059s
----
This commit is contained in:
Nigel Tao committed 2020-06-04 23:59:20 +10:00
1 parent d8cd72798a
commit 12b0f4c0bc
5 files changed
+3061 -4298

No files matched your search

+2 -1
View File
@@ -28,7 +28,8 @@ const (
CcompilersDefault = "clang-5.0,gcc"
CcompilersUsage = `comma-separated list of C compilers`
CformatterDefault = "clang-format-5.0"
// TODO: remove the -cformatter flag entirely.
CformatterDefault = "dumbindent"
CformatterUsage = `C formatter`
FocusDefault = ""
+14
View File
@@ -29,6 +29,20 @@
// indenting nested blocks. The output isn't 'perfect', but it's usually
// sufficiently readable if the input already has sensible line breaks.
//
// An example of "much, much faster", 70 times faster than clang-format:
// ----
// $ wc release/c/wuffs-v0.2.c
// 11858 35980 431885 release/c/wuffs-v0.2.c
// $ time clang-format-5.0 < release/c/wuffs-v0.2.c > /dev/null
// real 0m0.585s
// user 0m0.525s
// sys 0m0.041s
// $ time dumbindent < release/c/wuffs-v0.2.c > /dev/null
// real 0m0.008s
// user 0m0.005s
// sys 0m0.005s
// ----
//
// There are no configuration options (e.g. tabs versus spaces).
//
// Known bug: it cannot handle /* slash-star comments */ or multi-line strings