Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
cc expression methods; passed by value tempoaries seem avoidable
blauzahn:
I see no reason why the methods:
--- Code: ---ExpressionNode::ParseNodeType(wxString token)
ExpressionNode::IsBinaryOperator(wxString first, wxString second)
Expression::AddToInfixExpression(wxString token)
--- End code ---
get their parameters passed by value. To me it looks unnecessary inefficient if used often enough.
Don't we have a whole tree with lots of those?
I recommend to change these to const wxString&.
PS:
It we were in c++11-land, AddToInfixExpression may actually get its parameter passed by value, if
m_InfixExpression is empty most of the time and
--- Code: ---m_InfixExpression.push_back(token);
--- End code ---
were changed to something like:
--- Code: ---m_InfixExpression.emplace_back(std::move(token));
--- End code ---
... but that's a different story;-)
oBFusCATed:
wxString in wx2.8 has COW semantics, so these are pretty cheap.
But you can always provide a patch, with improvements.
blauzahn:
patch: #003558
--- Quote from: oBFusCATed on March 09, 2014, 05:16:54 pm ---wxString in wx2.8 has COW semantics, so these are pretty cheap.
--- End quote ---
Hasn't that changed with wx-2.9? And even then, COW is more work than no work.
oBFusCATed:
If you've profiled or benchmarked the code then we can draw conclusions about slow and fast parts.
Everything else is just guessing and people are notoriously known to fail to guess correctly :)
killerbot:
the patched version is definitely much better style, lead by example ;-)
Navigation
[0] Message Index
[#] Next page
Go to full version