hermes icon indicating copy to clipboard operation
hermes copied to clipboard

Same bundle generated with or without expensive optimizations option -O

Open ananyachandra14 opened this issue 6 years ago • 1 comments

Hi, adding the -O option while generating the hermes bundle doesn't make a difference to the output for me. Bundles with the same md5 checksum are generated. Is this expected in certain cases?

What is the purpose of the -O option? Is it supposed to make the size of the bundle smaller or is the bundle going to have a more optimized performance on device?

Thanks

ananyachandra14 avatar Apr 14 '20 14:04 ananyachandra14

We recently changed the default when Hermes compiles a file: it used to be un-optimized by default, but now it has been changed to optimize by default as of this commit: https://github.com/facebook/hermes/commit/2f86a21b8c96eebaaecaa92a58dffbeda024dcf2. Therefore there's no difference between specifying -O and not having any optimization option specified at all. Unfortunately our LLVM-based command-line-args parser doesn't indicate that it is the default option in our --help output.

We chose to make "fully optimize" the default because we saw a number of people doing benchmarks on non-optimized bytecode, resulting in incorrect times being generated.

If you want a completely un-optimized bundle you can use -O0. To allow optimizations that are safe for debugging, use -Og.

dulinriley avatar Apr 14 '20 17:04 dulinriley