I suggest you pay a decent consultant an 1-3 hours to teach you the basics.
there's a lot of nuances. This is what I did when I started, and it saved me weeks of effort. There's too many nuances/unexpected behaviours, so if you're doing this professionaly; get some proper advice. The O notation of aa's is about the least of your worries - there's at least 10 other things I can think of which could necessitate a complete redesign of your architecture if you don't know about them: so get some help!
Roku developers slack group (http://tiny.cc/nrdf0y) : georgejecook
Contact me on roku developer slack group, or via pm to discuss consultancy/work opportunities/rooibos unit testing framework