pointers - Which way is less memory intensive? -
i wrote methods operate on same struct, respectively slice of struct. @ beginning called each method on struct in different lines (go playground):
test.modify() test.modify2() ...
the second shot calling methods on output of previous method (go playground):
test2.modify().modify2()...
now i'm asking myself, 1 less memory intensive? or there other side effects not recognize? 1 go way it?
solution 1 works on addresses, there no values passed around. solution 2 returns references , more nice use - in opinion.
Comments
Post a Comment