[performance] Improve and optimize passing arrays into funcs/methods