exploit nil seqs for performance (#8688)

* changes $ for seqs to never produce 'nil'
* exploit the fact that empty seqs don't have to allocate in the code generator
This commit is contained in:
Andreas Rumpf 2018-08-20 11:54:18 +02:00 • committed by GitHub
commit 2def616069
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 20 deletions

View file

@ -2530,10 +2530,7 @@ proc `$`*[T](x: seq[T]): string =
##
## .. code-block:: nim
## $(@[23, 45]) == "@[23, 45]"
if x.isNil:
"nil"
else:
collectionToString(x, "@[", ", ", "]")
collectionToString(x, "@[", ", ", "]")
# ----------------- GC interface ---------------------------------------------