gintool / gin

GI in No Time - a Simple Microframework for Genetic Improvement
MIT License
43 stars 20 forks source link

Changed "testData" from List to Set. #45

Closed GiovaniGuizzo closed 3 years ago

GiovaniGuizzo commented 3 years ago

This is a performance improvement for the Method File reading procedure. This is related to issue #40.

I tried to read a method with 24k test cases, and it got stuck in the execution of lines 368-370 This is the profiling result:

image

The previous code would first check the existence of the test case before adding it to the list. When we have 24k test cases, the cost of such procedure becomes exponentially expensive. With a LinkedHashSet, the complexity of adding a test case to the set is O(1), while also keeping the insertion order. Now the input of 24k test cases takes about a second.

All tests are passing.