Same bundle generated with or without expensive optimizations option -O
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
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.