Performance: F("string") in a function
nosing around performance tweaks ran following:
2 performance related pieces of info:
1. f("string") - stores string in flash, , calls there when needed instead of storing in ram
2. after function runs, ram used function released , available again program.
if understand correct;:
the following a simplified example missing bits.
void printstring(){
lcd.print(f("hello world"));
}
void loop(){
printstring();
}
would waste of flash space ?
or f() usage here still giving performance gain ? (though little may in example)
looking @ given performance information, think if not use f() here, "hello world" string used when function called.
or, function loaded memory @ start up; , not use f(), bloat program total ram usage because of strings ?
2 performance related pieces of info:
1. f("string") - stores string in flash, , calls there when needed instead of storing in ram
2. after function runs, ram used function released , available again program.
if understand correct;:
the following a simplified example missing bits.
void printstring(){
lcd.print(f("hello world"));
}
void loop(){
printstring();
}
would waste of flash space ?
or f() usage here still giving performance gain ? (though little may in example)
looking @ given performance information, think if not use f() here, "hello world" string used when function called.
or, function loaded memory @ start up; , not use f(), bloat program total ram usage because of strings ?
both function , string in flash.
there no particular performance gain (possibly loss), you're not wasting precious ram constant string.
there no particular performance gain (possibly loss), you're not wasting precious ram constant string.
Arduino Forum > Using Arduino > Programming Questions > Performance: F("string") in a function
arduino
Comments
Post a Comment