LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-08-2011, 12:04 PM   #1
dhruv17singhal
LQ Newbie
 
Registered: Apr 2010
Distribution: Ubuntu Natty
Posts: 19

Rep: Reputation: 0
Does ccache take care of the optimization applied to the compiled code?


Hi,

I have recently began compiling custom-kernels and have come across ccache and distcc, two excellent tool to speed up the compilation. I was wondering whether ccache takes care that I had specified (or unspecified) optimizations like -Os, -O1, -O2, etc.? In other words, if I first apply, say, -O2 optimization and allow ccache to cache the optimized object file, and later if I compile the same code using, say, -Os, will ccache use the previously cached data, and thus ignore my new settings?

Ideally, ccache should allow the code to be completely recompiled with the new optimization settings, and then cache the new files, along with the previous ones, so that if I ever want to compile the code using either -Os or -O2 optimization, I would not have to wait for the complete code to be compiled again. Is that the case?
 
Old 03-08-2011, 05:13 PM   #2
ForzaItalia2006
Member
 
Registered: Dec 2009
Location: Walldorf, Germany
Distribution: (X)Ubuntu, Arch, Gentoo
Posts: 205

Rep: Reputation: 67
Quote:
Originally Posted by dhruv17singhal View Post
I have recently began compiling custom-kernels and have come across ccache and distcc, two excellent tool to speed up the compilation. I was wondering whether ccache takes care that I had specified (or unspecified) optimizations like -Os, -O1, -O2, etc.? In other words, if I first apply, say, -O2 optimization and allow ccache to cache the optimized object file, and later if I compile the same code using, say, -Os, will ccache use the previously cached data, and thus ignore my new settings?
First of all, here is a reference to a description of how ccache works. That should answer most of your future upcoming questions ;-)

To answer your specific question: ccache does not try to be more clever than you are. If you specify new options (e.g. -Os), ccache will not be able to find any cached results in its cache (because you only cached -O2) so that ccache will recompile your code.

Quote:
Originally Posted by dhruv17singhal View Post
Ideally, ccache should allow the code to be completely recompiled with the new optimization settings, and then cache the new files, along with the previous ones, so that if I ever want to compile the code using either -Os or -O2 optimization, I would not have to wait for the complete code to be compiled again. Is that the case?
Yes, think so. Unless you clear the cache, you'll keep all the previous results.

Best regards,
Andi
 
1 members found this post helpful.
Old 03-09-2011, 12:26 AM   #3
dhruv17singhal
LQ Newbie
 
Registered: Apr 2010
Distribution: Ubuntu Natty
Posts: 19

Original Poster
Rep: Reputation: 0
Thanks ForzaItalia2006, that's exactly what I wanted !
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP optimization & storing compiled files. sanimfj Linux - Server 2 12-17-2009 01:10 PM
LXer: Disruptive Innovation, Applied to Health Care LXer Syndicated Linux News 0 02-01-2009 11:12 AM
ccache RudraB Programming 3 08-11-2008 03:10 AM
glibc cannot be compiled without optimization dracayr Linux From Scratch 12 07-13-2008 04:30 PM
excluding code from gcc optimization gearoid_murphy Programming 7 03-12-2008 05:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration