Skip to content

Println optimize #3211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 28, 2015
Merged

Println optimize #3211

merged 2 commits into from
May 28, 2015

Conversation

Chris--A
Copy link
Contributor

This PR resolves issue #884

The sketch below dropped 30 bytes. The increase to ram is only 2 bytes (AVR). The changes aren't as big on the SAM core, but still show a slight improvement in code size.

/***

  Standard:
    Sketch uses 5,634 bytes (18%) of program storage space. Maximum is 32,256 bytes.
    Global variables use 228 bytes (11%) of dynamic memory, leaving 1,820 bytes for local variables. Maximum is 2,048 bytes.

  Proposed:
    Sketch uses 5,604 bytes (17%) of program storage space. Maximum is 32,256 bytes.
    Global variables use 230 bytes (11%) of dynamic memory, leaving 1,818 bytes for local variables. Maximum is 2,048 bytes.

***/

void setup(){
  Serial.begin( 9600 );
  Serial.println( F("Printing a flash string!") );
  Serial.println( 12.34567f, 4 );
  Serial.println( "A plain string" );
  Serial.println( 'a' );
  Serial.println( String( "A String" ) );
  Serial.println( 123456, BIN );
  Serial.println( 123456, OCT );
  Serial.println( 123456, DEC );
  Serial.println( 123456, HEX );
}

void loop(){}

@ffissore ffissore added Architecture: AVR Applies only to the AVR microcontrollers (Uno, etc.) Architecture: SAM Applies only to the SAM microcontrollers (Due) Component: Core Related to the code for the standard Arduino API labels May 25, 2015
facchinm added a commit that referenced this pull request May 28, 2015
@facchinm facchinm merged commit 9d13023 into arduino:master May 28, 2015
@facchinm
Copy link
Member

Merged, thank you!

@facchinm facchinm added this to the Release 1.6.5 milestone May 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Architecture: AVR Applies only to the AVR microcontrollers (Uno, etc.) Architecture: SAM Applies only to the SAM microcontrollers (Due) Component: Core Related to the code for the standard Arduino API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants