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
|
|
@ -1,11 +1,11 @@
|
|||
discard """
|
||||
output: '''obj2 nil
|
||||
obj nil
|
||||
obj3 nil
|
||||
output: '''obj2 @[]
|
||||
obj @[]
|
||||
obj3 @[]
|
||||
3
|
||||
obj2 nil
|
||||
obj nil
|
||||
obj3 nil'''
|
||||
obj2 @[]
|
||||
obj @[]
|
||||
obj3 @[]'''
|
||||
cmd: "nim c -r --threads:on $file"
|
||||
"""
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ doAssert "nan" == $(0.0/0.0)
|
|||
# nil tests
|
||||
# maybe a bit inconsistent in types
|
||||
var x: seq[string]
|
||||
doAssert "nil" == $(x)
|
||||
doAssert "@[]" == $(x)
|
||||
|
||||
var y: string
|
||||
doAssert "" == $(y)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue