2 ms·
> I assume the "five heap allocations" is kinda tongue in cheek? My understanding is that while it is good to avoid heap allocations, given this is a called-onc
by kibwen 6y ago
> I assume the "five heap allocations" is kinda tongue in cheek? My understanding is that while it is good to avoid heap allocations, given this is a called-once piece of code, it's not really a big deal?
Indeed. :) I can't envision a circumstance where avoiding exactly five small allocations outside of any loop would be observable in either time or memory usage. As a Rust programmer it simply provides a warm and fuzzy feeling to avoid allocations in places where it not only doesn't obscure the code, but actually makes it shorter. At best, this could be a small step towards running your code on embedded hardware (which isn't unreasonable for an emulator like this), but only if you were to also eliminate all other allocations within your program.
- Waterluvian 6y agoGiven some ROMs are multiple megabytes I'm not sure how this would work. Maybe I'm wrong but isn't the stack only a few MB in max size? Appreciate your earlier comments. Thanks.