Henko's picture

GameWindow loads slowly

Project:The Open Toolkit library
Version:1.1.0-2013-12-15
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

I have started experimenting with OpenTK on Windows. I have created a simple application with a GameWindow class that draws a triangle. I've noticed that it takes about 3-4 seconds for the game window to appear after starting the application. Why does it take so long? How can I make it faster? Thank you.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tksuoran's picture

#1

This may be related:

http://www.opentk.com/node/2330

I am currently using a custom version of OpenTK SVN that only loads a subset of entry points. I have managed to cut down the dll size to around 900kB, and I think startup times are also faster.

Henko's picture

#2

Hm, so you mean OpenTK loads too many extensions that I wouldnt even need? What are these?

the Fiddler's picture

#3

What video card and driver version are you using?

A saw a similar issue (3-4 seconds) after a recent Ati update but I haven't been able to pinpoint the cause.

Henko's picture

#4

Mine:
OS: Windows 7 x64
Card: ATI HD 5770
Driver version: 8.821.0.0 (2011.01.26.) Catalyst Version 11.2

Now installed driver: 8.850.0.0 (2011.04.19.) Catalyst Version 11.5
Still having the same issue.

Friend of mine:
OS: Windows 7 x86
Card: ATI Radeon HD 2600 XT
Driver version: 8.821.0.0 (2011.01.26.) Catalyst Version 11.2

He is also having the same issue.

I also tried on linux with mono, it started there instantly! It seems to be a Windows problem.

Henko's picture

#5

Here is the test application I used:
http://www.2shared.com/file/utcq3eHn/simple_OpenTK_test.html

It takes about 1 second for "Starting..." to appear in the console, then it takes 3 seconds for the gl window to appear.
I think this is quite annoying. Why is this faster on linux and mac?

static void Main(string[] args)
{
	Console.WriteLine("Starting...");
	MyWindow win = new MyWindow();
	win.Run();
}
tksuoran's picture

#6

I used SlimTune to profile. You have to let the app run a few seconds, I did not get any data if I closed the app too soon though.

Slimtune OpenTK startup

The contents of Test1.MyWindow.ctor() are the interesting part: most of that time is spent in GraphicsContext constructor (16%) and GraphicsContext.LoadAll (10%). Looking deeper, SetGraphicsModePFD() is taking time, and if you look even deeper than what is in the image, there seems to be some sort of recursive stuff going on.

Henko's picture

#7

Its one of the most annoying thing when I'm thinking about choosing OpenTK.
My applications need several seconds to load, and I don't want to loose another 4 seconds just for OpenTK to load.
So no idea for this issue?

the Fiddler's picture

#8

Status:open» confirmed

I can reproduce but the cause is not yet obvious.

A delay of ~350ms is to be expected given the current architecture but these 4 seconds are a new issue that only happens on Ati.

thomasd3's picture

#9

This also happens on nVidia; I have two computers that take 4 seconds before the window is opened and they both have nVidia cards; one has an old 8800 and the other one has a GT330

Is this linked to the number of extensions, or does it perform something else that takes time?
I can run some tests if there is something specific to troubleshoot.

thomasd3's picture

#10

From what I see, the issue is in LoadEntryPoints;
on the nVidia GT330, I have 2279 delegates to parse.

The two questions I have:
- Can these delegates be split up quickly in categories to determine what we need and what we don't? (maybe before doing some more expensive operations)
- Has anyone tried to replace the 'foreach' by a Parallel.ForEach to see what happens?