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

[RFC] Command buffers #169

Open
alteous opened this issue Jan 8, 2018 · 2 comments
Open

[RFC] Command buffers #169

alteous opened this issue Jan 8, 2018 · 2 comments

Comments

@alteous
Copy link
Member

alteous commented Jan 8, 2018

When updating scene objects, a small message is passed via a std::sync::mpsc channel which is later processed by the hub. This approach works well because it makes for an ergonomic API and is also thread safe; however, it may incur performance penalties for larger applications due to the pointer jumping and atomic operations.

I propose an alternative way of updating scene objects in addition to our current strategy. Essentially, it will let the user build up a Vec<Message> to be passed to the hub in a single large message instead of many small ones. Below is a demonstration of the idea:

Current approach

for object in &objects {
    object.set_visible(false);
}

Proposed alternative approach

let mut cmd_buf = factory.command_buffer();
for object in &objects {
    cmd_buf.set_visible(object, false);
}
cmd_buf.flush();
@kvark
Copy link
Collaborator

kvark commented Jan 8, 2018

This approach works well because it makes for an ergonomic API and is also thread safe; however, it may incur performance penalties for larger applications due to the pointer jumping and atomic operations.

Somehow, I don't expect much of a perf penalty for updates. It would be best to gather some numbers before changing the messaging API in this direction.

@vitvakatu
Copy link
Member

Agreed with @kvark. We can't decide without exact numbers.

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

No branches or pull requests

3 participants