Hi
I know that OpenGL need some time to perform initialization but is it possible to do it without freezing main thread? It's very annoying when I have to wait 2-4 seconds until main window will respond.
Paul
OpenGL initialization performance
-
- Newbie
- Posts: 60
- Joined: Fri Nov 22, 2013 12:00 am
Re: OpenGL initialization performance
I also wondered the same. It's really taking a lot of time.
In case it has to be the main thread, is it possible to do it in advance? I'd like to do it when my application starts up. For now, it seems to be delayed until the chart becomes visible.
In case it has to be the main thread, is it possible to do it in advance? I'd like to do it when my application starts up. For now, it seems to be delayed until the chart becomes visible.
Re: OpenGL initialization performance
Hello Paul and Jens,
I would like inform you that we are investigating about the performance problem you are experiencing we try to give you a good answer in shortest time as possible.
Thanks in advance,
I would like inform you that we are investigating about the performance problem you are experiencing we try to give you a good answer in shortest time as possible.
Thanks in advance,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: OpenGL initialization performance
Hello,
Find here a simple test project we made to check the OpenGL initialization times.
This example only uses a TDraw3D and creates the GLCanvas to measure the initialization time.
Here the results we got:
Delphi 7, Run
First run: 9328 millisec
Second run: 6469 millisec
Delphi 7, Running exe directly to avoid debugging
First run: 922 millisec
Second run: 469 millisec
XE7, Run
First run: 6360 millisec
Second run: 6500 millisec
XE7, Run without debugging
First run: 1047 millisec
Second run: 469 millisec
Note a big difference is noticeable between running the project with or without debug mode "Run without debugging".
The test project uses 3 fonts (Arial, Verdana i Courier New). Using one makes it considerably faster.
Also note the tests here have given very similar results when building&running the project for 32 and 63 bits in XE7.
If your times you get are much bigger, it may be due to hardware / driver.
Here the machine specifications we made the tests above with:
OS:Windows 8.1 64-bit
CPU: Intel Core i7-4771 @3.5GHz CPU
Memory: 16GB RAM
Primary drive: Samsung SSD 840 EVO
Graphics: NVIDIA GeForce GTX 760
Also note the Nvidia / Raedon control panels include some 3D settings globally used in all the applications or modifiable for a specific application or exe.
Find here a simple test project we made to check the OpenGL initialization times.
This example only uses a TDraw3D and creates the GLCanvas to measure the initialization time.
Here the results we got:
Delphi 7, Run
First run: 9328 millisec
Second run: 6469 millisec
Delphi 7, Running exe directly to avoid debugging
First run: 922 millisec
Second run: 469 millisec
XE7, Run
First run: 6360 millisec
Second run: 6500 millisec
XE7, Run without debugging
First run: 1047 millisec
Second run: 469 millisec
Note a big difference is noticeable between running the project with or without debug mode "Run without debugging".
The test project uses 3 fonts (Arial, Verdana i Courier New). Using one makes it considerably faster.
Also note the tests here have given very similar results when building&running the project for 32 and 63 bits in XE7.
If your times you get are much bigger, it may be due to hardware / driver.
Here the machine specifications we made the tests above with:
OS:Windows 8.1 64-bit
CPU: Intel Core i7-4771 @3.5GHz CPU
Memory: 16GB RAM
Primary drive: Samsung SSD 840 EVO
Graphics: NVIDIA GeForce GTX 760
Also note the Nvidia / Raedon control panels include some 3D settings globally used in all the applications or modifiable for a specific application or exe.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 60
- Joined: Fri Nov 22, 2013 12:00 am
Re: OpenGL initialization performance
Thanks for the Benchmark.
But please note that both of us were perfectly fine with the OpenGL initialization taking a bit of time. Our main gripe was the fact the main thread is blocked. If it really has to be the main thread, please give us a way to do it in advance.
When, for example, the TChart is put on a TPageControl and the user then switches to the chart, the whole application locks up. I'd be perfectly fine with the chart taking its time at application startup but not when the user has started working.
Oh and by the way: On my way slower machine it's 1840ms vs. 358ms with XE7
Update:
That code example is very useful!
I did some further profiling- The InitWindow command takes at least half of the time, the font stuff at least a third. The other parts are negligible
So:
Many thanks in advance
But please note that both of us were perfectly fine with the OpenGL initialization taking a bit of time. Our main gripe was the fact the main thread is blocked. If it really has to be the main thread, please give us a way to do it in advance.
When, for example, the TChart is put on a TPageControl and the user then switches to the chart, the whole application locks up. I'd be perfectly fine with the chart taking its time at application startup but not when the user has started working.
Oh and by the way: On my way slower machine it's 1840ms vs. 358ms with XE7
Update:
That code example is very useful!
I did some further profiling- The InitWindow command takes at least half of the time, the font stuff at least a third. The other parts are negligible
So:
- Thanks for showing us the TGLCanvas::InitWindow(..) command. That looks like pretty much what I was looking for
- Can you elaborate on the font stuff? Why is the number of different fonts used important? Is loading the fonts (and probably rasterizing them to Bitmaps so they can be used) what needs time?
Many thanks in advance
Re: OpenGL initialization performance
Yeray thanks for response. As Jens mentions the most interesting thing in enclosed project is that if we call InitWindow first time it took on debug mode 550-650ms but second time takes less than 20ms. Now we can use InitWindow on application startup and then all charts will appear much faster.
Re: OpenGL initialization performance
Hi,
I'm afraid I haven't found a way to initialize a Font apart, that would presumably allow you to move that initialization too.
jens.mertelmeyer wrote:
- Thanks for showing us the TGLCanvas::InitWindow(..) command. That looks like pretty much what I was looking for
Great to hear that helped you!Paul wrote:Now we can use InitWindow on application startup and then all charts will appear much faster.
The first time a font is used in a TextOut call, OpenGL initializes it and takes its time for it. Then, using the same font in different TextOut calls is almost immediate.jens.mertelmeyer wrote:
- Can you elaborate on the font stuff? Why is the number of different fonts used important? Is loading the fonts (and probably rasterizing them to Bitmaps so they can be used) what needs time?
I'm afraid I haven't found a way to initialize a Font apart, that would presumably allow you to move that initialization too.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |