ebiten: Slow startup time
Hello,
I’ve tried running the Hello World example from the website on Windows, macOS and Linux, with go run ebiten-hello.go
.
On Windows, it takes 3.7 seconds on average until the window is drawn. macOS is about the same, and Linux is slightly faster, but not by much.
I’ve compared this with a minimal example using https://github.com/go-gl/glfw, which takes 1.9s to display the window. Similarly, https://github.com/faiface/pixel also takes 1.9s.
Personally, I already find 1.9s to be quite long, but since go-gl/glfw doesn’t run any faster, I assume this is the fastest time we can get currently.
However, 3.7 seconds is quite a lot, and it’s a factor that discourages me from using Ebiten. Do you think this time could be improved? Can you think of any ways to run some profiling to figure out where specifically the issue is? I would also be happy to contribute to development if you had a few tips to help me along.
Thank you for developing Ebiten! 本当にありがとうございます!
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 19 (11 by maintainers)
Commits related to this issue
- internal/uidriver/glfw: use shoten sleeping time at waitForFramebufferSizeCallback Updates #1918 — committed to hajimehoshi/ebiten by hajimehoshi 2 years ago
- internal/ui: use the cursor position to choose the initial monitor for Windows Updates #1918 Updates #1982 — committed to hajimehoshi/ebiten by hajimehoshi 2 years ago
- internal/ui: use the cursor position to choose the initial monitor for Linux/UNIX Updates #1918 Closes #1982 — committed to hajimehoshi/ebiten by hajimehoshi 2 years ago
Thank you for the additional fix. On Linux, the window is fully drawn within 900ms, which is a massive improvement compared to how it was previously, and feels way better.
On Windows, it still takes almost exactly 2 seconds for the window to pop up, which is longer than on Linux, but is the same result that I had with go-gl/glfw, so there probably isn’t much more of a speedup that can be made on ebiten’s side. I’m happy for you to close the issue whenever you see fit.
Thanks to this fix, I’ll now try porting my project back over to ebiten. 😃
Oh, got it! With the new commit, drawing is completed after 1.1 seconds, which is much better! Thank you for this fix!
I assume the speedup is present on Windows as well, so I won’t test it right now, but let me know if you need me to do so.
A small note: those two tiny windows still open on Linux, but much more quickly. It would probably make for a nicer user experience if they didn’t appear at all. However, for now I’m very happy with this speedup. 😃
I just started testing Ebiten on an Mac Air M1 with go1.18beta1 darwin/arm64. The star example takes around 4 seconds to start. Most of the time seems to be before Main() is called. I tried multiple times it seems the same result every time.
I am not sure it is GLFW though - the following code executes almost instantly (pops up a window, then exits):
Thank you for the quick reply! The only way I know to take a profile is with
pprof.StartCPUProfile(f)
. Please let me know if that’s not what you need.I’ve taken a profile with the above code, and you can find it here: ebiten-hello.prof. I’m happy to do anything else I can to help.