Comments (12)
Hum... I'm not sure why this would be the case. I pretty much only use system/API calls to draw this in here https://github.com/emoon/rust_minifb/blob/master/src/native/macosx/OSXWindowFrameView.m#L25
I figured that this would be pretty fast but maybe that isn't.
from rust_minifb.
I'm not super comfortable with OS X (despite using it as a dev platform...) but I'll see if I can investigate this with a profiler.
from rust_minifb.
Using Instruments (that comes with XCode) should be able to trace down into the calls of a running process so that will likely give a hint on whats going on but I suspect some of the operations I would think should be on the GPU happens on the CPU instead (like the scaling)
from rust_minifb.
This is an old flamegraph I made while testing performance with minifb : https://github.com/jedahan/rustboy/blob/master/pretty-graph.svg might be some help, might not.
from rust_minifb.
It seems the majority of time in update_with_framebuffer is argb32_image_mark_rgb24, which from this stack overflow is kinda slow http://stackoverflow.com/questions/21665473/coregraphics-argb32-image-mark-rgb24-is-slow . Maybe there is a way to create a 32-bit context so no conversion is needed.
from rust_minifb.
And a possible solution from http://stackoverflow.com/questions/33075557/avoiding-colorspace-transformations-when-blitting-mac-os-x-10-11-sdk#33076871
colorSpace = ::CGDisplayCopyColorSpace(::CGMainDisplayID());
if (!colorSpace)
colorSpace = CGColorSpaceCreateDeviceRGB();
from rust_minifb.
In that benchmark from above, I got a ~25% total speedup, from average 44ms to 33ms with that patchset. Tested on my (retina) MacBookPro12,1.
from rust_minifb.
Following this post http://carol-nichols.com/2015/12/09/rust-profiling-on-osx-cpu-time/ , here are the flamegraphs with and without the change:
https://github.com/jedahan/scrap/blob/master/slow.svg
https://github.com/jedahan/scrap/blob/master/fast.svg
Theres a bit of a speedup, but argb32_image_mark_argb32 is still the slowest function...
from rust_minifb.
Thanks for the info. Yeah I wonder what that argb32_image_mark_argb32
is doing.
from rust_minifb.
Maybe it's actually doing the scaling inside this function (instead of actually doing it on GPU which would be 0 ms CPU time and very fast)
from rust_minifb.
To me it seems like the only way to get around it would be to implement this in OpenGL or Metal :/ Unless someone has a better idea.
from rust_minifb.
Hi, I have now rewritten the macOS backend to use Metal instead which should make this a lot faster. If you are still using minifb it would be great to hear if this improves things for you or not. I will close this for now but if it doesn't help please re-open this again
from rust_minifb.
Related Issues (20)
- Fails to compile on Raspberry Pi HOT 2
- Font / text support? HOT 1
- window.set_position() has a weird behavior HOT 6
- Document features HOT 2
- X11 unsoundness when using minifb with threads HOT 2
- F10 does not work on windows HOT 12
- wasm
- 5 button mouse support and more HOT 5
- Cursor not appearing HOT 5
- Is it possible to update the window while resizing it? HOT 2
- invisible window HOT 3
- Is it possible to completely remove the title bar? HOT 1
- Upgrade wayland-client version HOT 2
- Mouse coordinates are off in fullscreen, MacOS HOT 2
- Cursor style doesn't change on MacOS HOT 2
- Window::set_title no longer works on Linux since minifb 0.24 HOT 6
- How to show image subsequently like video? HOT 6
- Support raw_window_handle HOT 3
- Window is borderless even though borderless is set to false on WSL2 HOT 1
- Windows 11 cant make window transperant. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust_minifb.