Skip to content

Coding

Comparing Human and AI way for Big-String-Set Intersection Performance in Java by JMH

cover.png

Recently, I'm facing a case on my job, comparing two set of users and find the intersection as the result. But the difficult part is the number of set is quite big (both sets could be 10,000+ elements). To provide a better experiment for our users, the speed can not be too slow. So I want to find a relatively quick way to do the intersection work.

In this article, I use AI (Gemini, ChatGPT) and the 'old-school' way, Stackoverflow to find several ways to do the set intersection. And Use the JMH Java Microbenchmark Harness to run all the test and produce report.