I made a test, where data structure that are declared as reference works x10 faster. import sequtils echo "as value" let prices = (1..100_000).to_seq.map(proc (i: int): float = i.float) proc get_prices: seq[float] = prices for _ in 1..100_000: discard get_prices()[2] echo "done" echo "as reference" var prices_ref: ref seq[float] = nil prices_ref.new prices_ref[] = (1..100_000).to_seq.map(proc (i: int): float = i.float) proc get_prices_ref: ref seq[float] = prices_ref for _ in 1..100_000: discard get_prices_ref()[][2] echo "done" Run
- Do you have to use 'ref' for the field types within ref ob... Niminem
- Do you have to use 'ref' for the field types within r... Stefan_Salewski
- Do you have to use 'ref' for the field types with... Araq
- Do you have to use 'ref' for the field types ... ElegantBeef
- Do you have to use 'ref' for the field ty... cagyul
- Do you have to use 'ref' for the fie... Stefan_Salewski
- Do you have to use 'ref' for the fie... arnetheduck
- Do you have to use 'ref' for the fie... alexeypetrushin
- Do you have to use 'ref' for the fie... ElegantBeef
- Do you have to use 'ref' for the fie... Araq
- Do you have to use 'ref' for the fie... alexeypetrushin
- Do you have to use 'ref' for the fie... ElegantBeef
- Do you have to use 'ref' for the fie... alexeypetrushin
- Do you have to use 'ref' for the fie... ElegantBeef
- Do you have to use 'ref' for the fie... Hlaaftana
- Do you have to use 'ref' for the fie... alexeypetrushin
- Do you have to use 'ref' for the fie... Stefan_Salewski
- Do you have to use 'ref' for the fie... auxym
- Do you have to use 'ref' for the fie... Araq
- Do you have to use 'ref' for the fie... alexeypetrushin
- Do you have to use 'ref' for the fie... fxn