Last active
August 29, 2015 14:19
-
-
Save warrenseine/cc19097d07496c843f16 to your computer and use it in GitHub Desktop.
Emscripten size comparison between <iostream>, fprintf, and write
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
fprintf(stdout, "hello world\n"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int main() | |
{ | |
std::cout << "hello world" << std::endl; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
int main() | |
{ | |
write(1, "hello world\n", sizeof("hello world\n")); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: hello-fprintf.html hello-iostream.html hello-write.html | |
hello-fprintf.html: hello-fprintf.cpp | |
em++ -std=c++11 -O2 hello-fprintf.cpp -o hello-fprintf.bc | |
emcc -O2 hello-fprintf.bc -o hello-fprintf.html | |
hello-iostream.html: hello-iostream.cpp | |
em++ -std=c++11 -O2 hello-iostream.cpp -o hello-iostream.bc | |
emcc -O2 hello-iostream.bc -o hello-iostream.html | |
hello-write.html: hello-write.cpp | |
em++ -std=c++11 -O2 hello-write.cpp -o hello-write.bc | |
emcc -O2 hello-write.bc -o hello-write.html | |
clean: | |
rm -f *.bc *.js *.html *.html.map *.html.mem |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment