[webkit-dev] Better to store a local variable or call a method repeatedly?
Chris Fleizach
cfleizach at apple.com
Wed Jan 6 10:46:14 PST 2010
I see a lot of code that calls the same function a number of times in the same scope.
Is it better to store that result in a local variable, or is it better to repeatedly call a method...
in this example, node() is called two times
return !m_renderer->node() || !m_renderer->node()->isContentEditable();
Would it better to write it as
Node* node = m_renderer->node();
return !node || !node->isContentEditable();
More information about the webkit-dev
mailing list