[llvm-commits] [Patch] Replace switches with lookup tables (PR884)

Hans Wennborg hans at chromium.org
Fri Sep 7 03:23:36 PDT 2012


On Thu, Sep 6, 2012 at 8:12 PM, Sean Silva <silvas at purdue.edu> wrote:
> Great!
>
> I hope to see the small-integer followup patch soon!

Me too.

> btw, do you have any pre/post code/data size measurements? I would
> gather them myself, but my machine takes 20+ minutes per build :(

I've tried compiling Clang using Clang built from r163299 and r163305,
i.e. right before and after my change, respectively. These are the
numbers:

Using Clang built from r163299 (right before my change):
-rwxr-x--- 1 hwennborg eng 32399524 2012-09-07 10:54 Release/bin/clang
   text    data     bss     dec     hex filename
   27209071     1282264   47504 28538839        1b377d7 Release/bin/clang

Using Clang built with r163305 (includes my change):
-rwxr-x--- 1 hwennborg eng 31837890 2012-09-07 10:48 Release/bin/clang
   text    data     bss     dec     hex filename
   26642047     1287144   47504 27976695        1aae3f7 Release/bin/clang

That's a 1.7% or half a megabyte reduction in binary size, which is
more than I expected. I counted 426 replaced switches, though not all
of them would have ended up in the clang binary.

Thanks,
Hans



More information about the llvm-commits mailing list