View previous topic :: View next topic |
Author |
Message |
sindre Guru
Joined: 01 Nov 2002 Posts: 315 Location: Norway
|
Posted: Tue Feb 25, 2003 5:05 pm Post subject: Best CFLAGS for low memory/load times? |
|
|
What would be the "best" CFLAGS to use on a computer with low memory, but a descent processor? Also the HD is quite slow, so I suffer from low memory and long load times.
Which is better? -Os, -O3 or -O2? Any other important flags? Any gain if I use glibc-2.3.2_pre1 over glibc-2.3.1? I also plan to use prelinking.
Grateful for any input. |
|
Back to top |
|
|
PT_LAmb Guru
Joined: 22 Apr 2002 Posts: 332 Location: Lisboa (Lisbon), Portugal
|
Posted: Tue Feb 25, 2003 10:38 pm Post subject: |
|
|
I don't know much about the subject, but can tell you the following:
-O3 and -O2, are speed flags, setting one of them will optimize the binary to be a bit faster then a standard compiled one. I once read that -O3 doesn't improve much over -O2, can anyone confirm this?
-Os is a size optimization, setting this will reduce the binary file size, possibly compromising speed. I don't know if this optimization is considerable over the speed ones, but I sense that reducing the file size will also reduce the memory usage, but this is only significant if the program doesn't allocate much dynamic memory.
If you're running on a x86 machine, you can safely append -fomit-frame-pointer, because the frame-pointer is not needed on x86.
sindre wrote: | Any gain if I use glibc-2.3.2_pre1 over glibc-2.3.1? |
I really don't know...
sindre wrote: | I also plan to use prelinking. |
Prelinking will reduce your load time considerably considering you have a slow HD.
Good luck,
Ricardo Cordeiro
PS - Please correct me if I'm wrong. _________________ SETI@Home - http://setiathome.ssl.berkeley.edu/ |
|
Back to top |
|
|
invaderzim Tux's lil' helper
Joined: 16 Aug 2002 Posts: 93 Location: Louisville, KY
|
|
Back to top |
|
|
puddpunk l33t
Joined: 20 Jul 2002 Posts: 681 Location: New Zealand
|
Posted: Wed Feb 26, 2003 3:51 am Post subject: |
|
|
Yep, your much better of using -Os. Since you have small memory, you are going to see much more of a speedup than optimising with -03 (optimises code, but increases binary size, which then has to be stored in working memory).
-O3 only includes 2 extra flags than -O3, those two flags only operate in special conditions, but can sometimes act negatively for performance. -O2 is a lot more sensible and safer.
Don't know about GLIBC, I would definately use the stable version. The stable version has reliable prelinking too. |
|
Back to top |
|
|
PT_LAmb Guru
Joined: 22 Apr 2002 Posts: 332 Location: Lisboa (Lisbon), Portugal
|
Posted: Thu Feb 27, 2003 1:35 am Post subject: |
|
|
puddpunk, can you tell me a page that explains the few differences between -O2 and -O3, and their positive/negative impact on the system?
Thanks in advance,
Ricardo Cordeiro _________________ SETI@Home - http://setiathome.ssl.berkeley.edu/ |
|
Back to top |
|
|
invaderzim Tux's lil' helper
Joined: 16 Aug 2002 Posts: 93 Location: Louisville, KY
|
Posted: Thu Feb 27, 2003 2:32 am Post subject: |
|
|
look at my post..... |
|
Back to top |
|
|
David_Escott l33t
Joined: 12 Jan 2003 Posts: 952 Location: Boston, MA
|
Posted: Thu Feb 27, 2003 3:58 am Post subject: |
|
|
definitely look at that other thread as benchmarks can tell a lot more than anything else. But I would consider using speed optimizations for low end libraries (libc and such) and then size for user end things (gnome kde etc)
your ram concerns will really kick in when you get into X and the various userland programs, but a good fast core underneath that will help too. You should also look at the cache size of your processor since cache misses will make you fall back to ram which can slow things down. |
|
Back to top |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20067
|
Posted: Thu Feb 27, 2003 7:13 am Post subject: |
|
|
Followups to this thread. _________________ Quis separabit? Quo animo? |
|
Back to top |
|
|
|