I personally had never used StringConcatenate because it would have made my code less readable and probably wouldn't have save much time anyway.
https://docs.mql4.com/strings/stringconcatenate
"The StringConcatenate() works faster and more memory-saving than when strings are concatenated using addition operations (+)."
But since others evidently use this function I thought I would test it.
Result:
Addition -> 4110ms
Concatenation ->5484ms
Conclusion: StringConcatenate is worse than useless (in terms of speed at least)
And to be doubly sure of the test I swapped the test order so that the StringConcatenate was done first. Same sort of result, although there is variation from test to test due to the finite timer resolution. Any of you guys with faster machines might need to increase LOOPTILL, depending on your system timer resolution.
double str1 = 1.1; double str2 = 2.22; double str3 = 3.333; : result = DoubleToStr(str1,Digits) + DoubleToStr(str2,Digits) + DoubleToStr(str3,Digits); : result = StringConcatenate(str1,str2,str3);as concatenate does conversions just like Print/Comment.
It might be faster when adding string literals together (rather than string variables as in your example) but I doubt it would make any significant difference in 'everyday' code
Hello,
these are my results:
Original test 3 strings Addition = 2636
Original test 3 strings Concatenation = 2871
Quite in-line with the first topic... but if I start to concatenate 4 strings instead of 3:
4 strings Addition = 4556
4 strings Concatenation = 3962
With 6 strings:
6 strings Addition = 9891
6 strings Concatenation = 7519
With 9 strings:
9 strings Addition = 20155
9 strings Concatenation = 12854
It seems clear that StringConcatenate() start to outperform the simple string addition when we start to merge more than 3 strings together

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I personally had never used StringConcatenate because it would have made my code less readable and probably wouldn't have save much time anyway.
https://docs.mql4.com/strings/stringconcatenate
"The StringConcatenate() works faster and more memory-saving than when strings are concatenated using addition operations (+)."
But since others evidently use this function I thought I would test it.
Result:
Addition -> 4110ms
Concatenation ->5484ms
Conclusion: StringConcatenate is worse than useless (in terms of speed at least)
And to be doubly sure of the test I swapped the test order so that the StringConcatenate was done first. Same sort of result, although there is variation from test to test due to the finite timer resolution. Any of you guys with faster machines might need to increase LOOPTILL, depending on your system timer resolution.