curl -H "Content-Type: application/json" -X POST http://localhost:9200/test2/type1 -d '{ "name": "Marina" }'
curl -H "Content-Type: application/json" -X GET http://localhost:9200/test2/_search
Tuesday, June 20, 2017
Friday, April 28, 2017
Executable sizes
I was curious about the size of executables generated by different compilers in C and C++. So I made a small program that reads a list of numbers from stdin and prints the sum, then compiled it using several compilers and settings. You can find below the results.
The command line used:
clang++ -o main Main.cpp -O3 -static -static-libgcc -static-libstdc++
clang -o main Main.c -O3 -static -static-libgcc
Language | Operating system | Compiler | Runtime dependencies | Executable size in bytes |
C++ | Windows 10 | Visual C++ 2017 | Dynamic | 10,752 | C++ | Windows 10 | Visual C++ 2017 | Static | 290,816 |
C | Windows 10 | Visual C++ 2017 | Dynamic | 10,752 |
C | Windows 10 | Visual C++ 2017 | Static | 140,288 |
C++ | Ubuntu 16.10 | GCC 6.2 | Dynamic | 8,960 |
C++ | Ubuntu 16.10 | GCC 6.2 | Static | 2,202,384 |
C++ | Ubuntu 16.10 | GCC 6.2 | Static+strip | 1,771,096 |
C | Ubuntu 16.10 | GCC 6.2 | Dynamic | 8,528 |
C | Ubuntu 16.10 | GCC 6.2 | Static | 915,608 |
C | Ubuntu 16.10 | GCC 6.2 | Static+strip | 844,784 |
C++ | Ubuntu 16.10 | clang 4.0.0 | Dynamic | 8,984 |
C++ | Ubuntu 16.10 | clang 4.0.0 | Static | 2,202,320 |
C++ | Ubuntu 16.10 | clang 4.0.0 | Static+strip | 1,771,056 |
C | Ubuntu 16.10 | clang 4.0.0 | Dynamic | 8,352 |
C | Ubuntu 16.10 | clang 4.0.0 | Static | 915,528 |
C | Ubuntu 16.10 | clang 4.0.0 | Static+strip | 844,744 |
The command line used:
clang++ -o main Main.cpp -O3 -static -static-libgcc -static-libstdc++
clang -o main Main.c -O3 -static -static-libgcc
How to static link C and C++ runtimes in gcc 6.2
For C:
gcc -o main Main.c -O2 -static-libgcc -static
For C++:
g++ -o main Main.cpp -O2 -static-libgcc -static-libstdc++ -static
To make sure it worked:
ldd main
should not display any dependencies.
gcc -o main Main.c -O2 -static-libgcc -static
For C++:
g++ -o main Main.cpp -O2 -static-libgcc -static-libstdc++ -static
To make sure it worked:
ldd main
should not display any dependencies.
Subscribe to:
Posts (Atom)