Given an exemplary
type container struct {
arr int[]
}
I want to recursively manipulate its arr array field values.
I have two options, functionally:
- a (pointer receiver) method on
container, directly accessing itsarrarray - a function, receiving the
arrslice as parameter
In any case, alternating start and end indices have to be passed as parameters to each recursive call.
Question:
Are there any known, theoretically beneficial or detrimental impacts, mainly with regards to performance¹ and memory footprint, by using one implementation over the other and considering that arr will hold between 10^6 and 10^9 elements?
¹ running (unprofessionally bench-marked) test implementations, performance does not seem to be significantly different