I think the problem is because the "adding XP function" is relatively heavy and it gets called EVERY time a cannonball hits.
So big ship = More cannons = More hits at the same time = More lag.
Also, Higher Skills = Cannons Firing At the Same Time (instead of after each other with a random delay) = More lag at the same time.
My attempted fix reduces the number of function calls.
@Levis' one, if I understand correctly, tries to make the function calls that are left more efficient.
So it should at least be better than it was. Hopefully? Perhaps?
I
definitely have been noticing the effects on my computer as well.
Not enough to call it "unplayable" but definitely noticeable and I'd much rather have the game without cannonball hits causing that lag at all.