Re: Tips for fast string concatenation?

2013-06-21 Thread Steven Schveighoffer
On Fri, 21 Jun 2013 06:14:38 -0400, Jonathan M Davis wrote: On Friday, June 21, 2013 12:09:09 Gary Willoughby wrote: Have you any tips for using D when you need fast string concatenation? I regularly use code like this: foreach (i, range) { foo ~= bar; } or: f

Re: Tips for fast string concatenation?

2013-06-21 Thread Namespace
It's worth pointing out that Appender supports ~= so it's very easy to swap it in, replacing builtin concatenation. This works since 2.062 AFAIK. So is still quite new.

Re: Tips for fast string concatenation?

2013-06-21 Thread John Colvin
On Friday, 21 June 2013 at 11:33:29 UTC, monarch_dodra wrote: On Friday, 21 June 2013 at 10:09:10 UTC, Gary Willoughby wrote: Have you any tips for using D when you need fast string concatenation? I regularly use code like this: foreach (i, range) { foo ~= bar; } or: foo =

Re: Tips for fast string concatenation?

2013-06-21 Thread monarch_dodra
On Friday, 21 June 2013 at 10:09:10 UTC, Gary Willoughby wrote: Have you any tips for using D when you need fast string concatenation? I regularly use code like this: foreach (i, range) { foo ~= bar; } or: foo = foo ~ bar ~ baz ~ qux; I've used std.string.format(...)

Re: Tips for fast string concatenation?

2013-06-21 Thread Jonathan M Davis
On Friday, June 21, 2013 12:09:09 Gary Willoughby wrote: > Have you any tips for using D when you need fast string > concatenation? I regularly use code like this: > > foreach (i, range) > { > foo ~= bar; > } > > or: > > foo = foo ~ bar ~ baz ~ qux; > > I've used st

Re: Tips for fast string concatenation?

2013-06-21 Thread Vladimir Panteleev
On Friday, 21 June 2013 at 10:09:10 UTC, Gary Willoughby wrote: Are there faster ways of appending strings? You'll want to use appender, from std.array: http://dlang.org/phobos/std_array.html#.Appender

Tips for fast string concatenation?

2013-06-21 Thread Gary Willoughby
Have you any tips for using D when you need fast string concatenation? I regularly use code like this: foreach (i, range) { foo ~= bar; } or: foo = foo ~ bar ~ baz ~ qux; I've used std.string.format(...) in some instances which sped things up which surprised me. Are