Go Down

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


If there are things we can do so that DHCP and DNS aren't compiled in if they aren't used, that would be great. 

I thought we were already using the compilation parameters that enabled this? (Putting functions into separate blocks that aren't included by the linker if not used or something like that.)

What might make this a slightly moot point in terms of the example: Shouldn't the basic example use DNS anyway instead of hardcoding an IP address for Google?



Hmm.  In fact, the WebClient example does use DHCP for its initial config now.
I can't figure out how DNS is getting pulled in, though.  EthernetClient::connect() does call dns, but only in the method that has a string argument, so I thought that would be enough to get it omitted during link...

Coding Badly

Could a virtual connect be the culprit...

class EthernetClient : public Client {
  virtual int connect(IPAddress ip, uint16_t port);
  virtual int connect(const char *host, uint16_t port);


Dec 17, 2011, 06:11 am Last Edit: Dec 17, 2011, 08:20 am by pYro_65 Reason: 1
Maybe, two virtual members only creates an overhead of two pointers in the v-table ( pointers to the derived type ) during run-time.

But sometimes can increase code generation by upto 50 bytes per 'virtual' usage, sometimes even more.

If you have no need to control many different derived interfaces through a unique single interface, scrap the base class.

Arduino should #define it to turn off the client class when not needed.
Forum Mod anyone?

Go Up