Splitting tokens array into subarrays for performance

Split if size of tokens array is greater than 64K otherwise just use the tokens array as is like before.