Performance issue when overusing column in flutter - performance

How could I improve the performance of my app? I have to build it like on the gif, but when I have 4-500 items in the column it get's very laggy. See the delay of the hover effect at the end of the gif.
I tried to build something simmilar with Table but I couldn't create clickable rows with it, so I tried to make it using DataTable but it was worse than what you can see now in the gif.
For this I used Columns and Rows. On the long term the rows should be more complex of course which is not helping on the performance problem...
I know I should use ListView for big datasets but then it would scroll inside the card and not with the card...
How could I create something like this in a more efficient way?

Related

Vaadin 23 Excel like grid

I'm in the need of an Excel like grid in an attempt to convert an "application" written in Google Calc to a real application. I've got one implementation using Vaadin, but it (also) suffers from a long page construction. The screenshot below uses a CSS flex grid with individual divs, and given 6 weeks, there are over 5000 individual divs.
Constructing this page takes over 20 seconds, not something users will be happy about. I'm working on a version based on a table, but it does not seem to improve much. In the end the same amount of cells need to be constructed, whether they are DIVs or TDs does not seem to matter much.
Is there a way to construct such a grid in a more speedy way? I'm more than happy to solve "where did the user click?" on the server side. To be aware of: besides the number of cells themselves, each also has specific content, so just getting a grid shown is not enough.
Each component (div, or something else) is managed by the server. So when you have 5000 of them it's quite slow. You need to reduce the number of components managed by the server.
I can't give you a better answer since I don't know the requirements. But the idea is to try to combine some elements.
You have an example of a table generated ( instead of each element one by one) here: https://cookbook.vaadin.com/grid-details-table.
You can also create or own component. There is also a paid add-on: spreadsheet which seems to fit your needs. It's still in preview: https://vaadin.com/roadmap
The problem here is the complexity of the UI itself. Rendering 5000+ cells will be slow what ever method you use and what ever framework you use. There will be big amount of elements in the DOM and you need to load also lot of data upfront. And as you see the result is huge, and it wont fit most screens. So I would recommend further design of the UI. Is it really necessary to show all the weeks at once? Your UI's complexity will already reduce a lot if you show only one week at the time and add buttons to browse the weeks forwards and backwards. But even with that optimization you will have lot of columns. I would consider adding another browsing direction by day. Further knowledge of the actual purpose of the UI will naturally give more insight how to develop it further.

Google Sheets: Adding images to queried cells

So what I'm trying to do is add images that show up next to certain cells while maintaining the ability to have a drop down that will sort through various columns. I want to add visuals because the community this is for speaks many different languages, and I want it to be an accessible sheet.
I've made an example of what I'm trying to do on this sheet with some placeholder images on the "Data" sheet. These images aren't carried over to the "Sorted Data" sheet. I know the query function on its own can't be used to bring images in from another sheet, so I want to know how I could get this kind of setup while maintaining images. This sheet is editable.
While looking for answers, I found this: Google Sheets Query Image to show up from Query result
It's the closest I've seen. I'm struggling, however, on how I might translate this to what I'm trying to do here in terms of sorting the data. I've also seen people say some functions don't work with a lot of images, only loading a few. I'm not sure how true that might be, but just in case it's relevant, there likely will be a lot of images on this sheet.
I'm completely open to anything I may have missed, any changes I could make, any other functions, and script if necessary.
query is not suitable for this job. use:
=SORT(FILTER(Data!B3:W500, Data!C3:C500<>""))
=SORT(FILTER(Data!B3:W500, Data!C3:C500<>""), MATCH(Z3, B2:2, 0), IF(AA3="ASC", 1, 0))

Optimize UI layers in a listview (+screenshots)

I'm analyzing my approach with Gmail's android developer's team approach in order to optimize drawing times and generally create more efficient apps.
My approach:
Below is the hierarchy inside a listview. It's quite straightforward. ExpandableListContentItem extends a Relative layout which has 3 Views:
Gmail app:
The following screenshot is how the listview in Gmail app works (SwipableListView). It's interesting to see that there is only one View (I guess aY extends ConvertationItemView) which in reality is quite more complicated than mine (I see 3 texts, 1 photo, 1 icon/button).
Question:
I would assume that this is a more lightweight approach to get rendered, is it so? Even if it takes me more time to code an optimal single customview per listview item it is worth the performance that it offers?
Finally the only way I know so far is to inflate an existing view inside another which is basically the first approach. I guess now my challenge would be to combine that relativeLayout with the 3 nested views into one. Is that correct?
PS:examples, open source code are welcome.
I would assume that this is a more lightweight approach to get rendered, is it so?
Yes it is. When you consider hierarchy, every parent measures their dimensions and passes it to child views from top to bottom. Reducing layers and having more flat view will save time.
Even if it takes me more time to code an optimal single customview per listview item it is worth the performance that it offers?
Depends on application you are developing. Depends on number of items in a list and how you get them. When you scroll through the list, if you think it is slow you might want to try that approach. I tried it on my previous applications and I could see the difference.
I guess now my challenge would be to combine that relativeLayout with the 3 nested views into one.
I don't know what you mean by combining them but the way Gmail does it that they have their Custom View. You can create your custom view.
Besides that, another thing to consider is overdraw. It is as important as having flat views. If you activate GPU Overdraw from developer tools and look at Gmail app row, you will see 0 overdraw. Make sure your code has no overdraw.
For further reading I would recommend you to check these blogs :
Performance Tuning On Android
Android Performance Case Study

Images in datagridview once more time

I need your advice on a rather simple question - I'd like to draw an image in datagridview cell.
The problem is that the number of rows can be rather big: up to 100 000 of rows, sometimes more than that.
I tried using CellFormating but in this case the grid is blinking. I tried to set DoubleBuffered = true but it got only worse - the window hung and CPU usage was showing 100%. Other controls stopped drawing itself. Moreover it did not help blinking too much (even on several rows).
So I tried to use source DataTable and added a column. Than I filled it with images. But it was a fail: app memory grew very fast on a big datatable and it just crashed.
Also I tried using DataSourceChanged event and settings images like row[cell].Value = . It fires but grid works strange: sometimes it shows images, sometimes it does not. I read that you must set underlying data to make this working but it caused memory problems as I wrote.
I changed image to text so far but certainly I'd like to have moe user-friendly UI.
What can I do in this case? Probably I should give up images or change display logic at all? I.e. use virtual mode. I tried to use it long ago but I had some difficulties so I just skipped this way and my grid is working in non-virtual mode.
Ok, I eventually used CellFormatting event. It looks like blinking has gone away without my help. Images are looking fine.

Flex Chart making Browser unresponsive

I have an flex-3 swf(simple line chart- that use http-service to get data for the chart)
and in my application ,in one page i have to list multiple rows of data( normally more than 30 rows), for each row i have to include this chart .
problem is when the numbers of rows are increasing at the loading time the browser went in to unresponsive state.
I want to know how to handle this situation , is there any better way to show the single flex-3 chart multiple times in a page.
Charts are heavy components. I don't recommend using too much instances. Also, you seem to just create more and more instances of time, that is not the best solution. You should reuse instances. Check out how Flex uses item renderer.

Resources