I've written a simple command-line utility in Swift to help me parse and process some data files. The project only has about 400 lines of code, and uses some basic string handling, arrays, and dictionaries. I expect the resulting executable to be fairly small.
I use:
- Swift 3
- Xcode 8 beta 2 (8S162m)
- OS X 10.11.5.
The executable I build through Xcode ends up being 7.3M - much larger than I would expect.
However, when I compile the same code from the command line, using swiftc, the resulting file is about 120K - closer to what I would expect.
Some additional details:
- I'm building the Xcode project using using Product > Build For > Running.
- The executable is generated in the Build/Products/Release subdirectory of my project.
- Both Xcode and command-line compilation is done with -O -whole-module-optimization.
- Commenting out all my code in the Xcode project still results in a 5M executable.
What is the proper procedure for building a release version of a comand line utility using Xcode? I'm I doing something silly - like building the executable in debug mode without realizing it - or is this a bug due to the beta state of the toolchain?