I have a file which, when compiled to object file, has the following size:
- On Windows, using MSVC, it's 8MB.
- On macOS, using clang, it's 8MB.
- On linux (Ubuntu 18.04 or Gentoo), using either gcc or clang, it's 20MB.
The file (detailed below) is a representation of (a part of) a unicode table along with character properties. The encoding is utf8.
It occured to me that the problem might be that libstdc++ can't handle the file well, so I tried libc++ with clang on Gentoo, but it didn't do anything (the object file size remained the same).
Then I thought that it might be some optimization doing something odd, but once again I had no size improvements when I went from -O3
to -O0
.
The file, on line 50 includes UnicodeTable.inc
. The UnicodeTable.inc
contains a std::array
of the unicode codepoints.
I tried changing std::array
to C style array, but again, the object file size did not change.
I have the preprocessed version of the CodePoint.cpp
which can be compiled with $CC -xc++ CodePoint.i -c -o CodePoint.o
. CodePoint.i
contains about 40k lines of STL code and about 130k lines of unicode table.
I tried uploading the preprocessed CodePoint.i
to gists.github.com and to paste.pound-python.org, but both refused the 170k lines long file.
At this point I'm out of ideas and would greatly appreciate any help regarding finding out the source of the "bloated" object file size.