Go Down

Topic: Arduino 1.0 produces 25% larger binary? (Read 7 times) previous topic - next topic

fat16lib

SD.h has grown by almost 2KB for a simple example.  The SD/examples/ReadWrite sketch is 13580 bytes on 1.0 and it is 11686 bytes on 0022.

Most of this is due to new features added to the SD.h wrapper in 1.0.  The base code for SdFat has not been changed much from 0022.

Part is due to something else in 1.0.  For my new version of SdFat  a similar example, SdFatReadWrite, is 12098 bytes on 1.0 and 11682 on 0022.  So there is a 416 byte increase in this example with the same code on both systems.

westfw

Quote
look over my sketch to see if there was obvious memory waste.

I'm afraid the "interesting question" is not "how can we fix your sketch?", but rather "why did the sketch get 25% bigger?", so we don't particularly want to look at the source for your sketch, but the size of the binaries of everything involved...

barish

#12
Dec 04, 2011, 08:51 am Last Edit: Dec 04, 2011, 08:54 am by barish Reason: 1

Part is due to something else in 1.0.  For my new version of SdFat  a similar example, SdFatReadWrite, is 12098 bytes on 1.0 and 11682 on 0022.  So there is a 416 byte increase in this example with the same code on both systems.

If I understand there's something about 1.0 you don't know yet the cause. Well I hope someone will find out.

@westfw: nothing to be afraid for, I hope you can compile and fix something now. All I want is a smaller binary after all, no matter where the problem lies.

fat16lib

Looks like most of the increase is in Ethernet.  The Ethernet WebServer example is 10146 bytes on 1.0 but only 5446 bytes on 0022.  That's 4,700 bytes more.   

I didn't look at the library code for Ethernet but the example was not changed much.  Here is the diff for the example in 1.0 and 0022:
Code: [Select]
24c24
< IPAddress ip(192,168,1, 177);
---
> byte ip[] = { 192,168,1, 177 };
29c29
< EthernetServer server(80);
---
> Server server(80);
41c41
<   EthernetClient client = server.available();
---
>   Client client = server.available();


The SD library is about 1,500 bytes larger due to new features.  These two libraries add about 6,200 bytes.

barish

Thanks, fat16lib, so that must be the biggest chunk of my memory increase. But shouldn't there be some options for the lib to use less space? E.g. I don't need to open multiple files. I mean, 5k more or less, that must be important to many users (I imagine).

Go Up