Hi
I was attempting some codility mock tests, and you get a report at the end, two scores, one for correctness (your program works), and second for performance (it scales well).
The problem is known as TapeEquilibrium, essentially an array traversal segmenting the array and subtracting values, returning the lowest difference.
It was suggested to use
Java 8, which I happily attempted.
Can you guys give me any indications why performance is so bad, but also, how it might be improved?
Performance tests
medium_random1, random medium, numbers from 0 to 100, length = ~10,000 8.993 s TIMEOUT ERROR running time: 8.99 sec., time limit: 4.20 sec.
medium_random2 , random medium, numbers from -1,000 to 50, length = ~10,000 9.057 s TIMEOUT ERROR running time: 9.06 sec., time limit: 4.12 sec.
large_ones, large sequence, numbers from -1 to 1, length = ~100,000 >10.000 s TIMEOUT ERROR running time: >10.00 sec., time limit: 4.66 sec.
large_random, random large, length = ~100,000 >10.000 s TIMEOUT ERROR running time: >10.00 sec., time limit: 4.76 sec.
large_sequence, large sequence, length = ~100,000 >10.000 s TIMEOUT ERROR running time: >10.00 sec., time limit: 4.25 sec.
large_extreme, large
test with maximal and minimal values, length = ~100,000 >11.000 s TIMEOUT ERROR running time: >11.00 sec., time limit: 5.03 sec.