Improve performance of concatenation

When invoked with a large number of intermediate results, concatenation
was performing badly. This patch should fix such behavior.
Merge pull request #99 from bastih/feature/improve_concat_many_pcs

Improve performance of concatenation
Merge remote-tracking branch 'upstream/master'