Professional Documents
Culture Documents
PROJECT ID - 10120
Presented By
Sunil Kumar Patra & Debadatta Nayak Roll No:200710427 & 200710374[1]
PROJECT PRESENTATION-2011
AGENDA
National Institute of Science & Technology
Introduction
Code Optimization
Objectives
Implemented Algorithms
Elimination Of Blank Lines & Blank Spaces
Elimination Of Unused Variables
Elimination Of Dead Functions
Elimination Of Unused Header File
Test For Program Termination
Conclusion
Recommendation for Future Improvements
Sunil Kumar Patra & Debadatta Nayak Roll No:200710427 & 200710374[2]
PROJECT PRESENTATION-2011
INTRDUCTION
National Institute of Science & Technology
Sunil Kumar Patra & Debadatta Nayak Roll No:200710427 & 200710374[3]
PROJECT PRESENTATION-2011
Cont…
National Institute of Science & Technology
Sunil Kumar Patra & Debadatta Nayak Roll No:200710427 & 200710374[4]
PROJECT PRESENTATION-2011
CODE OPTIMIZATIONS
National Institute of Science & Technology
Sunil Kumar Patra & Debadatta Nayak Roll No:200710427 & 200710374[5]
PROJECT PRESENTATION-2011
OBJECTIVES
National Institute of Science & Technology
Sunil Kumar Patra & Debadatta Nayak Roll No:200710427 & 200710374[6]
PROJECT PRESENTATION-2011
8. 8.printf("\nThis is a test");
11. }
Sunil Kumar Patra & Debadatta Nayak Roll No:200710427 & 200710374[7]
PROJECT PRESENTATION-2011
IMPLEMENTED ALGORITHM
National Institute of Science & Technology
STEP 4: Check the output in blank1.c containing no extra blank space and blank
lines
Sunil Kumar Patra & Debadatta Nayak Roll No:200710427 & 200710374[8]
PROJECT PRESENTATION-2011
Declared
//BEFORE OPTIMIZATION //AFTER OPTIMIZATION
1.#include<stdio.h> 1.#include<stdio.h>
2.main() { 2.main() {
3. int var1=1, var2=2, var3=3, var4=5; 3. int var1=1, var2=2, var3=3;
4.if(var1){ 4.if(var1){
5.printf(“possible”); 5.printf(“possible”);
6.} 6.}
7. Var1= var2+ var3; 7. Var1= var2+ var3;
8. printf("\n\nthis is a testl......"); 8. printf("\n\nthis is a testl......");
9.return 0; 9.return 0;
10.} 10.}
Sunil Kumar Patra & Debadatta Nayak [9]
Roll No:200710427 & 200710374
PROJECT PRESENTATION-2011
Cont..
National Institute of Science & Technology
Sunil Kumar Patra & Debadatta Nayak Roll No:200710427 & 200710374[10]
PROJECT PRESENTATION-2011
Sunil Kumar Patra & Debadatta Nayak Roll No:200710427 & 200710374[12]
PROJECT PRESENTATION-2011
Sunil Kumar Patra & Debadatta Nayak Roll No:200710427 & 200710374[13]
PROJECT PRESENTATION-2011
Cont…
National Institute of Science & Technology
IMPLEMENTED ALGORITHM
National Institute of Science & Technology
STEP 4: End
Sunil Kumar Patra & Debadatta Nayak Roll No:200710427 & 200710374[15]
PROJECT PRESENTATION-2011
Cont…
National Institute of Science & Technology
1. #include <stdio.h>
Defined Variables
2. main()
a b c d k
3. {
4. int a , b=1,c=2,d,k;
Used Variables
5. Char ch; b c b c a b
6. a=b*c;
7. b=b +2;
8. c=c+3;
Dead Variables
9. d=a; d k
10. k=b;
11. return 0; }
Sunil Kumar Patra & Debadatta Nayak Roll No:200710427 & 200710374[16]
PROJECT PRESENTATION-2011
Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming and
error-prone.
So finally eliminating the header files which are not being used in the
program but declared can optimize the program with respect to program size
and running time.
Sunil Kumar Patra & Debadatta Nayak Roll No:200710427 & 200710374[17]
PROJECT PRESENTATION-2011
IMPLEMENTED ALGRITHM
National Institute of Science & Technology
IMPLEMENTED ALGRITHM
National Institute of Science & Technology
Sunil Kumar Patra & Debadatta Nayak Roll No:200710427 & 200710374[19]
PROJECT PRESENTATION-2011
Sunil Kumar Patra & Debadatta Nayak Roll No:200710427 & 200710374[20]
PROJECT PRESENTATION-2011
CONCLUSION
National Institute of Science & Technology
Our discussion has focused on elimination of blank lines and blank space,
removing unused variable, dead code elimination, elimination of unused header
files and automatic test for program termination.
To read a file from disk, sort its contents and write the result back out, ought to
be a very doable performance optimization exercise.
Turning on the optimizations in the compiler sometimes exposes new
problems in the source program; thus testing must again be performed on the
optimization code.
Complete optimization is impossible; there is always room left to optimize,
thus it is pointless to sustain too much effort in pursuit of it. Absolutely
optimization is also not a completely unattainable goal.
Sunil Kumar Patra & Debadatta Nayak [23]
Roll No:200710427 & 200710374
PROJECT PRESENTATION-2011
REFERENCES
National Institute of Science & Technology
[4] Cook, B., Gotsman, A., Podelski, A., Rybalchenko, A.AND VARDI
M. Y. “Proving that programs eventually do something good”,
POPL, PP 1-17, 2007
THANK YOU