-
Notifications
You must be signed in to change notification settings - Fork 13
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
Several Performance Improvements #13
Conversation
Pinging @banesullivan for his thoughts... If possible, it would be great to have this released as The biggest performance bottleneck right now is having to use software rendering as there seems to be no way to render off-screen with a GPU. It doesn't matter at the moment for me as I'm primarily using docker containers on a kubernetes cluster, but in the future, off-screen rendering would be ideal. I understand there's a big push in Kitware to move towards a lightweight java client, and I think that will work in most situations, but when you have a gigantic model you'd like to render, it's tough to send across 100 MB (or more) of data and expect the client to render it on a potato. Server side render does still have its niche. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is excellent work! Thanks, @akaszynski!!
|
||
self.draw_image(self.get_image(force_render=True)) | ||
tstart = time.time() | ||
self.put_image_data(self.get_image(force_render=True)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good find!
self.render_window.GetRGBACharPixelData(0, 0, self.width - 1, | ||
self.height - 1, 0, arr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome 🤯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We definitely need to send that over to PyVista
This is an excellent module and I've already made some use of it on a closed source project, but it's speed leaves much to be desired. I've cleaned up the interface a bit and changed the implementation somewhat to improve the performance. Namely:
put_image_data
with the image array rather usingBytesIO
and writing a fake file. About a 5-10% performance improvement depending on the size of the window and the base render time.GetRGBACharPixelData
. I saw a mention of this on SO and investigated it. Turns out it's way faster thanvtk.vtkWindowToImageFilter
, and I'm seeing an extra 30% performance improvement on VTK 9 and minimal improvement on v8. It's good enough that we should consider rewriting the screenshot saver withinpyvista
unless I'm missing something.Miscellaneous Changes
Canvas
. Lots of people are comfortable with mouse wheel zoom, and I was really missing this when playing around with it. It's an option in the init ofViewInteractiveWidget
weakref.ref
instead of a direct reference to the render window to avoid gc issues.