Two potential performance improvements to investigate. The first one comes from user redditpirateroberts on Reddit.
- Read from both samples in a single loop instead of separate loops for each sample.
- Change the counts object from a hash map to an array as array indexes are faster to access, so convert:
table[one[a]] = {one:0, two:1} instead to table[one[a]] = [0, 1]
Two potential performance improvements to investigate. The first one comes from user redditpirateroberts on Reddit.
table[one[a]] = {one:0, two:1}instead totable[one[a]] = [0, 1]