Skip to content
This repository has been archived by the owner on May 29, 2020. It is now read-only.

Make buffer flushes faster #22

Closed
Fingercomp opened this issue Aug 3, 2018 · 3 comments
Closed

Make buffer flushes faster #22

Fingercomp opened this issue Aug 3, 2018 · 3 comments

Comments

@Fingercomp
Copy link
Member

The Framebuffer:flush is too slow, and we basically need to make it faster.

@Fingercomp Fingercomp mentioned this issue Aug 3, 2018
4 tasks
@Fingercomp Fingercomp self-assigned this Aug 3, 2018
@Fingercomp
Copy link
Member Author

Fingercomp commented Aug 4, 2018

The framebuffer divides the whole area into square blocks (or rectangular if they happen to be on the right/bottom edge), and assigns something called "dirtiness" to each of them. It's incremented if a cell in the block gets dirty (changed since the last flush). The flush method iterates over the blocks, skipping those whose dirtiness is 0 (meaning they didn't change since the last flush at all), and compiles instructions to render changes in each of them.

Well, at the no-blocks branch, I tried to remove the concept of blocks and operate over the whole area. I had to get rid of fills as well, unfortunately. (If the branch is merged, we will probably need some code that finds the rectangles to gpu.fill. Or we could leave it as is. I don't know.)

The effect of this change was a little suprising to me. The code got cleaner.

...

I mean, the master version flushes in 1.6 seconds on my emulator; the no-blocks version manages to bring it down to 0.9 s or so. Therefore, I think I'll merge this branch as soon as we compare the perfomance on an in-game computer. In the meanwhile I need to find a way to convince myself that we can do without fills for some time.

@Fingercomp
Copy link
Member Author

The no-blocks edition is indeed faster than no-no-blocks: 0.45s -> 0.35s on the latest OC. So I've merged the branch to master. Now I need to get rid of duplicate code... and, yet again, try to improve the perfomance.

@Fingercomp
Copy link
Member Author

I have no idea what else I can do to make it even faster. Closing for now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant