corona icon indicating copy to clipboard operation
corona copied to clipboard

Simulator performance fix: treat repeated keys as handled

Open ggcrunchy opened this issue 2 years ago • 1 comments

In the simulator, holding the up and down keys will slow things down dramatically in Windows. For instance, throw a few emitters out and do so and they'll draw to a crawl.

This seems to concern this issue.

I don't know why only those keys seem to be affected. It did look like they might get hashed deep in their name lookup maps, but that's just a wild guess.

Anyhow, when repeating keys are detected, Solar is just backing out and trying some fallback logic. I don't know if this is necessarily expensive, but it's probably a pretty noisy event.

Since nothing else is going to handle it, it seems enough to mark this as handled and avoid those costs. (The speed increases substantially.) The Android skin / backspace logic seems to be fine, since that assumes a key up anyhow. (Incidentally, the repeat logic there is probably overkill, what with the key-is-up-and-was-up case.)

ggcrunchy avatar Jun 14 '22 02:06 ggcrunchy

I can confirm, after integrating these changes, the simulator no longer experiences FPS drop when holding up or down keys. This PR would resolve https://github.com/coronalabs/corona/issues/358.

XeduR avatar Aug 05 '22 10:08 XeduR

Any timeline for getting a review for this to resolve issue #358, @Shchvova & @scottrules44?

XeduR avatar Sep 19 '22 11:09 XeduR

@Shchvova I just checked out the pull, and fixes #358 in my testing. Can you look at this or merge this request?

Screen Shot 2022-09-21 at 4 58 42 PM

scottrules44 avatar Sep 21 '22 21:09 scottrules44