CFLAGs optimizations - General Discussion and Assistance - CHDK Forum supplierdeeply

CFLAGs optimizations

  • 7 Replies
  • 2517 Views
*

Offline Hacki

  • ****
  • 358
  • SX100
CFLAGs optimizations
« on: 24 / August / 2008, 19:26:02 »
Advertisements
Hello,

I just played with the cflags in $(TOPDIR)/makefile.inc, and came to some interesting results:

Using -Os instead of -O2 decreases the memisosize for the SX100 (on juciphox.. ) from 54e68 to 52848.

Specifying -march=armv5te decreased the memisosize again to 527d8.

The boot time of chdk decreased from ~3 seconds to like 1,5. Means the OSD is shown almost instantly after bootup.

Everything still seems to be working fine, so i suggest those flags get added to SVN? CHDK bootup "feels" a lot better like that..

I know that -Os strips away some debugging symbols, but i dont think those are needed anyways, as the cams gives no debug output, if something goes wrong..

Regards

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: CFLAGs optimizations
« Reply #1 on: 25 / August / 2008, 00:45:02 »
hm, if this is true: nice find!
if not: still nice find :D

true as in: debugging stuff not needed and so on.

Re: CFLAGs optimizations
« Reply #2 on: 25 / August / 2008, 02:48:03 »
-Os optimizes for size; -O2 optimizes for speed without _increasing_ size.

Adding a -g will add debugging symbols, removing them is done with the strip utility.

*

Offline whim

  • ******
  • 2023
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: CFLAGs optimizations
« Reply #3 on: 25 / August / 2008, 02:49:49 »
@Hacki

Correct me if I'm wrong, but in my (vanilla) juciphox 490 $(TOPDIR)/makefile.inc I have (line 235-242)
Quote
CFLAGS=-fno-inline -Os -fno-strict-aliasing
# flags for gcc v4
# CFLAGS+=-mtune=arm946e-s
CTHUMB=-mthumb
CFLAGS+=-mthumb-interwork
CFLAGS+=-I$(topdir)include $(PLFLAGS) $(CPPFLAGS)
CFLAGS+=-DPLATFORM=\"$(PLATFORM)\" -DPLATFORMSUB=\"$(PLATFORMSUB)\" -DHDK_VERSION=\"$(VER)\" -DBUILD_NUMBER=\"$(BUILD_NUMBER)\" -DCAMERA_$(PLATFORM)=1
CFLAGS+=-Wall -Wno-unused -Wno-format
... which would mean it already uses this flag ?

or are you referring to HOSTCFLAGS (line 219) ?
Quote
HOSTCFLAGS=-g -O2 -Wall

I'm asking because I tried your optimizations and only appear to get the (small) -march=etc size reduction.

wim
« Last Edit: 25 / August / 2008, 02:55:58 by whim »


*

Offline Hacki

  • ****
  • 358
  • SX100
Re: CFLAGs optimizations
« Reply #4 on: 25 / August / 2008, 06:35:01 »
Quote
Correct me if I'm wrong, but in my (vanilla) juciphox 490 $(TOPDIR)/makefile.inc I have (line 235-242)
..
... which would mean it already uses this flag ?

I dont know how the Os flag came there, in my local working copy (Rev #491, the same as 490..) it was -O2 in line 235..
I'm totally convinced of that, but svn diff confirms that there already was a -Os ..

It appears as if someone changed it in SVN?  ??? I cant explain it otherwise to myself. I just made a fresh checkout, and the binarys size results in 52218 .. but i KNOW that it was 54e68 yesterday.. not alone because of the MEMISOSIZE=0x55000 in sx100's makefile.inc ....

Edit: It's -Os in the souces of my autobuild server as well, (they are from 21. august) Thats frigging weird.  >:(





« Last Edit: 25 / August / 2008, 06:37:06 by Hacki »

*

Offline whim

  • ******
  • 2023
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: CFLAGs optimizations
« Reply #5 on: 25 / August / 2008, 06:58:01 »
Even weirder: I checked my archives, my oldest trunk there is r290,
and it already has '-Os' ...

applying '-march=armv5te' on juciphox 490 works though, and
gives me a 326944 - 326848 = 96 bytes reduction (for ixus70_sd1000)

wim

*

Offline Hacki

  • ****
  • 358
  • SX100
Re: CFLAGs optimizations
« Reply #6 on: 25 / August / 2008, 07:03:08 »
Well, seems like i mixed something seriously up then.  :)

Sorry guys.  :-[

*

Offline whim

  • ******
  • 2023
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: CFLAGs optimizations
« Reply #7 on: 25 / August / 2008, 07:12:26 »
Gremlins are everywhere, spent half a day bug hunting once, only to discover that
I had accidentally changed my sourcecode by grazing my touchpad with a sleeve  :lol

wim


 

Related Topics