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:
parent
f87a91a3ec
commit
2def616069
6 changed files with 23 additions and 20 deletions
|
|
@ -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 ---------------------------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue