#If I use `_ = my_variable` would that mean that variable would never be even made?

1 messages · Page 1 of 1 (latest)

rocky dragon
#
const my_variable = ... // a sum of numbers i wanted to see whether its causing a slowdown or not, this is just a plain sum of some fields from a struct
_ = my_variable

would my_variable even be computated?

copper lark
#

if the computation doesn't have side effects, up to the optimizer

#

you can use std.mem.doNotOptimizeAway to force it to be calculated