In the below code everything works fine. str is of type StringBuilder. It take 20 seconds to finish the loop.
BUT, if I change the type of the variable to str to String and instead of using Invoke Code, if I simply use Assign like str = str+“abcd”. It also takes 20 seconds to complete.
I know StringBuilder is much faster. I do some research in console application. That took only 2 seconds to complete loop of 10000 in StringBuilder.
Hello @rramakrishnan
In addition to what @sarathi125 said, please be aware that if you are only looping a hundred times the performance benefit will be very small. The + operator uses StringBuilder internally. When the code compiles there is slightly more overhead time but over 100 loops you won’t notice it. Especially if you’re only doing that one append.