Re: is char[] faster than string?

2017-04-07 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 5 April 2017 at 22:05:07 UTC, H. S. Teoh wrote: If you are doing lots of concatenation and produce a single big string at the end, take a look at std.array.appender. Though if you're concerned about performance, you really should run a profiler. Last I heard, appender may not be

Re: is char[] faster than string?

2017-04-06 Thread Gary Willoughby via Digitalmars-d-learn
On Wednesday, 5 April 2017 at 21:58:16 UTC, Inquie wrote: What I am looking for is something like StringBuilder in C#. std.array.appender

Re: is char[] faster than string?

2017-04-06 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 5 April 2017 at 21:58:16 UTC, Inquie wrote: What I am looking for is something like StringBuilder in C#. If you want it to not copy data on expand, there's nothing like that in D yet. I wrote one for myself :)

Re: is char[] faster than string?

2017-04-05 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Apr 05, 2017 at 09:58:16PM +, Inquie via Digitalmars-d-learn wrote: > I have a lot of string concatenation to do and I'm wondering if char[] > is faster? Does it simply extend the buffer or are new buffers created > every time? > > What I am looking for is something like StringBuilder

Re: is char[] faster than string?

2017-04-05 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 5 April 2017 at 21:58:16 UTC, Inquie wrote: I have a lot of string concatenation to do and I'm wondering if char[] is faster? No, they are the same. Does it simply extend the buffer or are new buffers created every time? Both will extend the buffer when the runtime can

is char[] faster than string?

2017-04-05 Thread Inquie via Digitalmars-d-learn
I have a lot of string concatenation to do and I'm wondering if char[] is faster? Does it simply extend the buffer or are new buffers created every time? What I am looking for is something like StringBuilder in C#.