- DelphiTools - https://www.delphitools.info -

Source Code for the String Concatenation/Building Benchmark

apples_and_a_monsterBy popular request, here is the source code used for the previous String [1] benchmarks StringConcatBench.zip [2], essentially to test alternative memory managers.

The source is nothing complicated as you will see, just a set of simple function with the test cases, and a couple function that measure run times.

Only the benchmark functions are in the zip, the UI involved proprietary components, so you wouldn’t be able to compile it anyway. To run a bench, just pass one of the test functions to one of the measure functions, you’ll get a run time as result.

Dependencies of the unit go to:

To run the tests without blocking your UI, you can use light-weight IOCP worker-threads [6], an implementation is part of DWScript utility classes.

I would be interested to know about your findings on alternative memory manager, if you post about it, let me know and I’ll link from here! My gut feeling is that they won’t be enough for TStringBuilder to become truly competitive or even just get ahead of trivial string concatenation, but who knows?