Skip to content

Commit 03b414d

Browse files
ynfleee7
andauthored
Refactor: avoid intermediate allocations
Co-authored-by: ee7 <[email protected]>
1 parent 579534c commit 03b414d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/representer/types.nim

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import std/[sequtils, tables]
1+
import std/tables
22
import mapping
33

44
type
@@ -10,5 +10,7 @@ type
1010
map: string
1111

1212
proc switchKeysValues*(map: IdentMap): OrderedTable[string, NormalizedIdent] =
13-
toSeq(map.pairs).mapIt((it[1], it[0])).toOrderedTable
13+
result = collect:
14+
for key, val in map.pairs:
15+
{val: key}
1416

0 commit comments

Comments
 (0)