At the moment i'm trying to optimize my c++ code to get better performance, because I have a strong java/c# background. I've tested simple examples like getter/setter between classes and realized using them with references like this:
vector<string>& MyClass::getNum()
{
return num;
}
void MyClass::setNum(vector<string> &num)
{
this->num = num;
}
(let say 15+ Strings are in the Vector)
is faster 2x faster than without. (no difference when using simple/small parameter, but huge diff. when using Vectors etc.)
I also tried the same example in Java, but somehow my Java code is still faster than in C++. Someone can help me?