String vs Array concatenation

2022-08-22 Thread mratsim
> Copying strings is computationally trivial because they are guaranteed to not > contain complex types like seqs might. You can just copy their entire block > of memory verbatim once. That can definitely be tens or hundreds of times > faster than copying individual items. Probably we can speci

String vs Array concatenation

2022-08-22 Thread Hlaaftana
The procs in system above with the signature `proc `&`*[T](x, y: sink seq[T]): seq[T]` (notice sink) are supposed to optimize by using inplace `add` (which will not always copy), but they don't seem to do so. Using `add`, if possible, is what you are supposed to do. Copying strings is computati

String vs Array concatenation

2022-08-22 Thread drkameleon
I've been benchmarking a bit to see how different things work (in Arturo) and one of these is: concatenation/appending-to an array vs a string. The exact same operation is slower for arrays than for strings. Which is not so surprising. What _is_ surprising is that what I'm calculating is roughly