Silverlight datagrid performance - ScrollToPercent - performance

I'v run into an preformance releted problem with a DataGrid in an Sliverlight 4 application that I'm currently working on.
In our application we have a DataGrid which is quite huge, up to 4000 rows.
Its obviously extreamly slow to scroll a grid this big. Lets say you grab the tracker in scrollbar at the top and drag the mouse courser to the bottom. The tracker eventually reaches the bottom but it takes a few minutes.
It seams like Silverlight wants render ALL rows that it passes.
Using the ScrollToPercent method works like a charm though, so what I would like to do is to use ScrollToPercent when you release the tracker.
You follow? Lets say I grab the tracker and then I can move it up and down the scrollbar WITHOUT the view changing, but as soon as I release the tracker it should trigger a ScrollToPercent.
Did that make sense? Is this possible, or do you have a suggestion that in another way can help me solve this problem?

Related

Stop ExtJS grid from scrolling on refresh

I have a grid in ExtJS 6.0.2 that can be set to auto-refresh (it reloads once every ~10 seconds), but when it does, I want it to stay where it is instead of scrolling to the top each time. We have successfully used preserveScrollOnRefresh to do this with other grids, but for one particular grid, it's not working. In order to try to get it working, I decided to try calling getScrollY() before reloading the store and setScrollY() after, but that didn't work either. When I stepped through with the debugger, for some reason, getScrollY() returned 0 even when I had the grid scrolled all the way to the bottom.
Is there anything else that I can try?
it sounds like this is working for other grids in your app, so without seeing any code I'd suggest that something with that store/grid ecosystem is not configured the same as other grids in your app.
perhaps post a fiddle (fiddle.sencha.com) with an example, that may also help you find your answer if the fiddle works.

KnockoutJS IE8 performance issues and memory leaks

We build complex enterprise application using KnockoutJS and faced poor performance especially in IE8. Application might take more than 1GB of RAM and never frees memory. During investigation we discovered that KnockoutJS keeps references to the DOM nodes and never deletes it. This can be reproduced using IESieve against any public KnockoutJS example, just watch DOM utilization while playing with example which adds and deletes DOM nodes.
Have anyone faced this problem and has any ideas of how to work this out?
We had faced similar issues with knockout JS on IE 8. One of the problem areas was having an observable array (with 500+ elements) and building a UI (imagine a table like or list like structure) with all of those.
The only work around that worked for us was to change the view model so that it contains only very few items that could fit on the screen. Also, we had to add handlers for scroll events so that the observable array would keep getting refreshed. And (not too proud of this), we had to add an empty div at the top of the displayed records to give an illusion of the view having scrolled.
Probably to do with event bindings not being released when their DOM elements get deleted. If it's something thats happening under the hood with knockout, you will have to patch and submit a pull request.
I've had this kind of thing happen a lot with backbonejs too. JavascriptMVC is a bit better for cleaning up after itself.

Page items sliding in in metro style apps

I'm experimenting with creating a metro style app with Visual Studio 2012, I am not the most experienced designer but one thing with my applications is confusing me.
I have been working with 'basic pages' instead of blank ones for the different pages in my application for design consistency, however it seems that these 'basic pages' have a strange behaviour. Every item I place on the page (buttons, text boxes, etc) will all slide in one by one when the page opens. For example if I run the application and navigate to a page with 10 buttons, it will do a brief animation where each button will slide in from the right side to the left side. When dealing with a large number of items on one page this can take a lot of time as each item slides in seperatley.
Looking at the properties for each item I have been able to change the direction it slides in while loading the page by changing the flow direction. Also with a bit of research I am thinking it could potentially be due to either the metro style 'enterPage' or 'enterContent' animations, though I can not be certain.
I have tried to experiment and figure this out, and search to find out what causes this so I can modify it (Ideally I would like to just group items together to slide in with each other) however it's kind of a difficult thing to search with vague words, so I'm asking here.
What is causing this and how might I go about modifying it?
EnterPage shouldn't be sequencing the animations. They do offset some of the animations of a number of elements, but it shouldn't be each one sequentially.
Are you using WinJS navigation?
Well after a bit of experimentation I figured out that putting all my page content inside a grid made them all come in at once like I wanted. I probably should have tried that earlier but everything was already inside an outer grid for the page, so I thought that woulda handled it.
I don't quite understand it fully, but that works for now.

What could possibily slow down my flex mobile application?

I am working with flex for the last two years on some desktop apps. Until now I never had any performance related issues but today as we completed a mobile application for the iPad, I'm facing a challenge, the application is incredibly slow on the iPad.
http://i.stack.imgur.com/qkbWn.png
Slow, means that when I press a button in the menu to change the splitview I must wait something like 5s. Then scrolling is really slow two, with less than one fps and my TextInput starts to bug (the text is not in his box anymore).
I started to read a lot of blog post and presentation about optimisation for the mobile platform and then I rewrite some of the components I use. I removed the SkinnableContainer for instance and replaced it by a VGroup including some actionScript based drawing.
Now what you see is a VGroup (the dark grey one) containing some others VGroup (the group with title here) and then each widget is an HGroup with a label and a Widget. I only use Label and TextInput for the text.
Creation time is slow even (several seconds to create the view) for another page where there is only 4 text widget on it, or another one with only a list with a custom item renderer where each row is a set of 4 labels.
The whole things is cabled with RobotLegs, with nothing fancy, one models is injected in the view and at the beginning I set a member variable on the view with this object to bind my variables.
Frankly my thinking right now is : it smells fishy because if I've done everything right it is impossible to have such low performance and thinks that flex is competitive on the mobile platform. So right now I'm trying to disable the application piece by piece to try to locate what could slow it like that. I've got a couple suspects to check, for instance I've got some binding warning to check, and then see if robotlegs has got its share of the problem.
So my main question here is what do you think, and could you have some ideas about "is there a problem" and "how do we solve it".
Thanks
Run profiler for startup and separatelly for each operation that takes longed that it needs. Then prioritize the problems and try to solve them with basic optimization techniques.
Some problems you will not be able to solve fast - e.g. time for creating big components. The only option there is to rewrite those components with AS3 without MXML, styles and anything. I'm sure that flash.text.TextField is created many times faster than mx.controls.Label. The same for other components.
When component is created, it can be reused at a very low price. In your app there must be a lot of places where you recreate while you can reuse old components. It will save you memory and time.
Layouts tend to redraw even when it's not needed. If you have a lot of nested layouts, find the most critical places and replace a series of layouts with one custom layout or even component.
This all is very developer time consuming. At the end you will not get a smooth app anyway, but I believe that it can become usable.

Silverlight Listbox Performance issue with ListBox

I'm developing a Silverlight application that displays items in a listbox control and I've run into a bit of a performance issue.
Each item in the listbox is a custom stackpanel with some formatted text and such.
When I've got a list of 500 or less items the listbox works fine, but loading more than this causes problems. At 1000 items, Silverlight will consume 10% cpu, even if I'm not doing anything, at 3000 items the cpu constantly uses 32-36%.
This is on a dual core machine, on an older machine I tested out on the cpu usage goes way up.
This also effects the framerate, I'm getting 6fps with a 3000 item listbox, which makes the application sluggish.
Does anyone know what might be causing this? My first thought was that silverlight is trying to render all the items, even though the items are off screen... this seems to be consistant as if I insert items with their Visability.Collapsed, the extra cpu overhead is not present.
PS: I'm running in windowless="true" as I need to display some html ontop of my silverlight form.
You should use the DataGrid in Silverlight 2 because it supports UI Virtualization. It has been tested with millions of items and will only create enough visuals needed to display.
Your guess is basically correct. Although Silverlight does not attempt to render all 3000 elements in the ListBox, it still needs to create 3000 ListBoxItem objects, which in turn get Measured and Arranged during layout time, etc, only for them to get clipped at render time. Layout happens much faster when the elements are Collapsed (since there is basically nothing for layout to do in this scenario).
WPF has VirtualizingStackPanel which would solve this problem, unfortunately Silverlight doesn't have this element.
+1 for using the Silverlight DataGrid in this scenario, make sure you have the latest version installed as the default Silverlight SDK version has a few bugs.
Another option is to use the free Silverlight DataGrid Control available here. One of it's features is also a Virtual StackPanel Row Container which means the grid can handle an unlimited number of rows.
Compare the performance of each and see which works best in your situation.
Just an observation - it looks like this is not an issue anymore with Silverlight 4. Adding 100K elements to a data-templated list box is instantaneous and it renders just fine as well.
This helped me: Silverlight DeferredLoadListBox .
It is written by David Anson, a Microsoft employee.
The DeferredLoadListBox derives from ListBox but has much better performance.

Resources