wgpu icon indicating copy to clipboard operation
wgpu copied to clipboard

Why is the initialization so slow?

Open mrjbom opened this issue 1 year ago • 1 comments

When running the examples, the initialization of wgpu takes at least 500 ms. I'm running the release build of hello_triangle. To measure the time, I used std::time::Instant::now() at the beginning of the run() function, and the time until event_loop.run() starts was at least 500 ms.

Total initialization: 576
Instance: 202
Surface: 0
Adapter: 143
Device and queue: 85
Shader: 0
Render pipeline: 0
Surface configure: 140

Shutdown is also quite slow. I'm running the example on Windows, and the correct backend is selected: GTX 1080 with Vulkan.

Is this normal? It seems very strange, considering that a similar triangle example on pure Vulkan(but C++) starts almost instantly.

mrjbom avatar Aug 24 '24 12:08 mrjbom

It seems very strange, considering that a similar triangle example on pure Vulkan(but C++) starts almost instantly.

Could you provide the numbers for the C++ example?

Using a profiler would give more actionable data to work with.

teoxoy avatar Aug 28 '24 10:08 teoxoy

Using a profiler would give more actionable data to work with.

I was doing this, the reason for the long creation of Instance was the creation of DX12 and Vulkan instances at the same time, I haven't checked the rest yet. Anyway, it doesn't seem like a big problem right now to spend a lot of time on it. Thanks for the reply.

mrjbom avatar Aug 29 '24 19:08 mrjbom