Short article to concluding the mini-series on String Concatenation

Short article to concluding the mini-series on String Concatenation
http://www.delphitools.info/2013/11/05/multi-threaded-string-building-in-delphi/

Comments

  1. Can I download the sources, so I can do some profiling and testing with for example ScaleMM2 too? :)

    ReplyDelete
  2. I'll be glad to receive the source code as well. Thanks.

    ReplyDelete
  3. Eric Grange Thanks for the source.
    I think it would be interesting to benchmark 1000 times 10 append to different TStringBuilder, TStringStream, TWriteOnlyBlockStream, TStringData and TTextWriter. This would be more representative to a real application. IMO, in a real application, you have to frequently build DIFFERENT strings by appending different parts. As your benchmark is done, you don't really take the time required to create and destroy the classes.
    Of course there are cases where you append a large number of strings to build a very large string, for example building an XML document as a single string. This is imo not very frequent and should anyway not be implemented like that.

    ReplyDelete
  4. François Piette Depends what you're doing, appending 1000 strings as in the test case is what you would do to generate a JSON for a 5x10 dataset (1 append for data, 1 append for separator, for each field). And that's for a JSON writer that wouldn't do any unnecessary concatenation (ie. .

    FWIW in the "10" case (single-threaded) I get:
    - StringBuilder: 17.2
    - Trivial: 10.2
    - TWOBS: 5.8

    TWOBS benefits from a mini-Pool, so allocation/de-allocation are quite cheap. It's as fast as "Trivial" starting from the "2" case, and already faster in the "3" case.

    ReplyDelete

Post a Comment