Sunday, October 28, 2018

Lab 3

In our lab 3 we used different compiler options to see how it actually affected the code we gave to the compiler.

I worked in class with the group at the table on other members computers so we had a group effort to try different things and talk about what happened.

First we tried

gcc -g -O0 -fno-builtin -o initial source.c

as  our base line compile. This gave us a pretty small file and was rather fast and the made a small amount of assembler code.

The second test was with the -static option

gcc -g -O0 -fno-builtin -static -o static source.c

This yielded a very large file in comparison to the original file it gave us. This made a static call to the function rather than a dynamic, which made the function calls faster but the program large because it had to make the static library for it.

Third we got rid of the  -fno so we has just nobuiltin

gcc -g -O0 -o nobuiltin source.c

This gave us a similar sized file to the first one but the it was supposed to speed up the printline calls in the program, switching them to another type of call making it  slightly more efficient.

Forth we tried with nog 

gcc -O0 -fno-builtin -o nog source.c

We got a slightly larger file it seemed but it gave us debug info in the code so it was easier to read.  

No comments:

Post a Comment