Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: towards more optimal rendering in cOPs #17

Open
wants to merge 19 commits into
base: render-writer
Choose a base branch
from

Conversation

jcorbin
Copy link
Contributor

@jcorbin jcorbin commented Dec 10, 2017

A PoC that doesn't yet actually work; but you know what's better than two display buffers? Just One.

It can be more optimal for sparse updates since it will (and can potentially do better) by moving diagonally between chunks.

Plus it introduces something to own the write/byte buffer between rounds.

@kriskowal
Copy link
Member

This kind of experimentation is why I love reinventing the wheel. Between my discovery that using "\r" is more suited than CSI CUD when the renderer might be used to update a log leader, and your epiphany that it could be faster to update diagonally, we might be onto something.

One thing is certain: there’s more than one way to render, so loosely coupling the display and renderer(s) will be key.

I’m sure you noticed my diff that also introduced a Renderer to own the writer. It did not produce the effect I was looking for, but it is interesting that we both made things with the same name on the same day.

@kriskowal
Copy link
Member

Also, when benchmarking, let’s keep in mind that cursor optimizations are designed mostly to reduce network traffic, so these apps perform alright over ssh. I’m not sure how relevant that is, but my assumption was that spending CPU time to avoid writing a lot was classically valuable.

24 bit color is very wasteful on the wire, but that’s irrelevant if we’re optimizing for fat clients that run locally. Do your benchmarks even reveal a performance gain in RenderOver vs Render? There might be more to gain from preparing the write buffer with reusable chunks than there is in preparing one-use cursor motions and only drawing invalidated cells.

@jcorbin
Copy link
Contributor Author

jcorbin commented Dec 10, 2017

Heh, great questions:

name                old time/op    new time/op    delta
_displayDemo/4-4      4.61µs ± 0%    3.70µs ± 0%   ~     (p=1.000 n=1+1)
_displayDemo/8-4      16.3µs ± 0%    13.1µs ± 0%   ~     (p=1.000 n=1+1)
_displayDemo/16-4     61.9µs ± 0%    50.2µs ± 0%   ~     (p=1.000 n=1+1)
_displayDemo/32-4      244µs ± 0%     199µs ± 0%   ~     (p=1.000 n=1+1)
_displayDemo/64-4      968µs ± 0%     794µs ± 0%   ~     (p=1.000 n=1+1)
_displayDemo/128-4    3.89ms ± 0%    3.16ms ± 0%   ~     (p=1.000 n=1+1)
_displayDemo/256-4    15.8ms ± 0%    12.9ms ± 0%   ~     (p=1.000 n=1+1)

The "new" side just uses a single display and Render()s it every frame.

@jcorbin jcorbin changed the base branch from cops_simp_ren_cur to render-writer December 10, 2017 03:18
@kriskowal
Copy link
Member

I think the conclusion is that we provide both Render and RenderOver, and let the developer decide whether size on wire is important. Do I read this right?

@jcorbin
Copy link
Contributor Author

jcorbin commented Dec 11, 2017 via email

@kriskowal
Copy link
Member

kriskowal commented Dec 11, 2017 via email

@kriskowal kriskowal removed their request for review August 21, 2020 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants