First I tried to use normal PHP arrays (using integer as the key and amount of entries as the value), but I was not happy about performance, so I decided to look for more specialized data types. Though using them improved memory usage a little bit, but did not improve timings.

Also I decided to use pagination because the amount of duplicates is huge and browser was not happy about it

The better solution would be to use queries and chunk by chunk process the information on background


Kind of surprisingly, but on linux server the performance became much better

GENERATE NEW SET
Integer Count of duplicates
9959925 2
9960079 2
9960110 2
9960297 2
9960532 3
9960618 2
9960800 2
9960844 2
9960917 2
9960939 2
9961155 2
9961379 2
9961486 2
9961880 2
9961920 2
9961952 2
9962006 2
9962084 2
9962576 2
9962737 2