Created
June 20, 2013 19:03
-
-
Save andyhuey/5825634 to your computer and use it in GitHub Desktop.
string concatenation in AX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static void AjhTestTextBuffer(Args _args) | |
| { | |
| // ajh 2013-05-24: is the TextBuffer faster than using string concatenation? | |
| // from http://www.mail-archive.com/axapta-knowledge-village@yahoogroups.com/msg07289.html | |
| TextBuffer tb; | |
| str a,b; | |
| int i,j; | |
| int ts, te; | |
| ts = WinAPI::getTickCount(); | |
| tb = new TextBuffer(); | |
| a = ''; | |
| b = 'This will be appended to "a" multiple times. '; | |
| for (i=0; i<30000; i++) | |
| { | |
| //j = xGlobal::randomPositiveInt32(); | |
| //b = int2str(j); | |
| //a = a + b; // Finished in 68.02 secs!!?? | |
| //a += b; // Finished in 0.52 secs. | |
| tb.appendText(b); // Finished in 0.17 secs. | |
| } | |
| a = tb.getText(); | |
| te = WinAPI::getTickCount(); | |
| info(strFmt("Finished in %1 secs.", (te-ts)/1000)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment