Comparing GoTo Surfing with True Surfing?

Jump to navigation Jump to search

Again, when a True Surfer adds second wave surfing, the score increases a lot. When a GoTo Surfing adds second wave surfing, the score decreased a lot. Is this phenomenon common? Or it just because it adding another wave exploits some hidden bug in my code?

Xor (talk)12:10, 1 September 2017

It might be causing you to skip turns. Goto surfing does a lot more calculations in a single tick.

Otherwise I would say it is a bug, maybe with the starting conditions of your second wave surfing. Most difficult to get right for me was aligning the time I switch to surfing second wave with when I actually stop surfing the first wave in my real movement.

Skilgannon (talk)13:06, 1 September 2017

I would say it's perfectly aligned, from the debug graphics the predicted next wave path is exactly the same as when it really happens.

However, I create a billion of new objects per surf ;p for every predicted new position, every stop status, etc.

But I never ever skipped a turn on my computer :( whereas I see a lot of very low score on the literumble which I can never reproduce on my computer.

May be I should eliminate all the object allocation in loops ;( I used to thought Java would use stack allocation for those objects after escape analysis (which is available since Java 6 update 14), but it doesn't.

Xor (talk)04:16, 2 September 2017

My thought are, why take the risk? Making an allocation pool or hoisting the allocation outside of the loop for frequently created/deleted objects is fairly easy. Also less pressure on the GC will make a GC run during your tick less likely, so you are less likely to skip turns. Stack analysis is good, but I'm not sure how it deals with nested objects. I suspect there is still a heap allocation internally, which can be hoisted out of most loops quite easily.

Skilgannon (talk)21:34, 2 September 2017