Tuesday, 15 March 2011

java - Defining variables in function call vs passing locally defined variables to functions -



java - Defining variables in function call vs passing locally defined variables to functions -

is there performance gain between next 2 scenarios ?

(here, design of function : frameswitchblue(cardlayout layout, drawable image, string str, boolean to_blue) )

1 - declaring local variables parameter values , them passing them function. eg :

drawable image = getresources().getdrawable(r.drawable.tech_2); string str = getresources().getstring(r.string.tech_vibrt_play_snd); cardlayout prev_view = findviewbyid(r.id.parent); frameswitchblue(prev_view, image, str, false);

2 - straight defining variables in function call. eg :

frameswitchblue(findviewbyid(r.id.parent), getresources().getdrawable(r.drawable.tech_2), getresources().getstring(r.string.tech_vibrt_play_snd), false);

i reducing object creating slight part of me says compiler need create objects in background anyway. right ? scenario 2 give me performance advantages (minus readability in scenario 1)?

java android performance

No comments:

Post a Comment