Strategies for initialization/optimization

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

greggorob64
Posts: 183
Joined: Tue Mar 18, 2014 2:55 pm

Strategies for initialization/optimization

Post by greggorob64 » Fri May 30, 2014 12:48 pm

I'm loading several charts onto the screen, and its taking up to 1second a piece, which is much higher than i'd like it to be.

I'm wondering if there's any strategies i can take to try to cut this down lower?

*note* this is with a code profiler attached. I know these numbers are overstated because of that.

A few points/questions:

[*]I'd love to unload any type of initialization into the background. My application locking up for 12 seconds while it draws 12 charts is sad. I know the 'new' on the chart has to be done in the gui thread, but does adding series and axis also have to be done in the foreground?

[*] Things like adding a pointlineseries and yaxis are taking upwards of 50ms on my machine to add to the chart. Is there anything i can do to lower the 'complexity' of the controls to make them initialize quicker? Maybe things like turn mouse interaction off?

[*] Any general notes or strategies i can use to speed up the initialization?

Thanks!

User avatar
ArctionPasi
Posts: 1366
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland

Re: Strategies for initialization/optimization

Post by ArctionPasi » Fri May 30, 2014 3:26 pm

Sounds really slow...

Before giving more tips, can you check that you have used chart.BeginUpdate...EndUpdate around the initialization. It prevents chart refreshing after every property change, and the final EndUpdate is the one that actually needs to render the chart.

If you are changing any RenderOptions properties, it's best to pass the RenderSettings structure as parameter to LightningChartUltimate constructor instead.
LightningChart Support Team, PT

greggorob64
Posts: 183
Joined: Tue Mar 18, 2014 2:55 pm

Re: Strategies for initialization/optimization

Post by greggorob64 » Sat May 31, 2014 12:07 pm

I am using begin and end update. I am generating a lot of graphs In a tab well. Some are standard 2d time domain, some 3d spectrogram, and some 2d

However, all use begin and end update. The 50 ms time comes is when I have ants code profiling enabled, so the time Is overstated.

However, I'm sure I'll looking at a minimum of seconds per chart of setup time

User avatar
ArctionPasi
Posts: 1366
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland

Re: Strategies for initialization/optimization

Post by ArctionPasi » Sat May 31, 2014 5:27 pm

I guess that the delay may come from HLSL effects compiling, that 3D surfaces and 2D heatmaps use. Optimizing that would need some restructuring our code.

Would it be possible for you to send me your application (or reduced mock-up), and I can profile it with LightningChart source code and give exact answers. Also please share some info of your computer specs, especially video adapter type and processor model.
LightningChart Support Team, PT

greggorob64
Posts: 183
Joined: Tue Mar 18, 2014 2:55 pm

Re: Strategies for initialization/optimization

Post by greggorob64 » Mon Jun 02, 2014 2:47 pm

That would take a significant amount of time; but I probably should. It might be a few weeks; but i'll definitely want to readdress this and i can send you a zipped solution, thanks.

User avatar
ArctionPasi
Posts: 1366
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland

Re: Strategies for initialization/optimization

Post by ArctionPasi » Mon Jun 02, 2014 3:03 pm

Great. Meanwhile I'll try to find a time slot to optimize the HLSL compilation time.
LightningChart Support Team, PT

greggorob64
Posts: 183
Joined: Tue Mar 18, 2014 2:55 pm

Re: Strategies for initialization/optimization

Post by greggorob64 » Thu Jun 05, 2014 5:07 pm

I took some time to readdress this, and i was able to make it much more manageable, albeit way more complicated.

I'm initializing 15 (for example) lightning charts, each on their own tab.

My order is now this:

call 'new' on 15 usercontrols

using async/await tasks to populate all of my data into the charts, as well as all chart initilization.

Any code that requires operations be done in the gui thread I use control.invoke. This allows to use LINQ asParalel as well, to leverage as much of the cpu as possible.

The time is now magnitudes faster.

User avatar
ArctionPasi
Posts: 1366
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland

Re: Strategies for initialization/optimization

Post by ArctionPasi » Thu Jun 19, 2014 12:45 pm

We have improved the Intensity, Surface, Persistent intensity layers and multi-colored line charts initialization time in v.6.0.6 assembly pack. When HLSL effects compilation took up to several seconds, now it's only 10-20 ms.

We have also improved the rendering performance of these a lot.

Please give it a try :D
LightningChart Support Team, PT