提高性能微调 [英] Improve Spinner Performance

查看:167
本文介绍了提高性能微调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经有12个链接到20000多条记录单个数据库表纱厂工作的活动。每个喷丝绑定到一个不同的查询做出选择动态(基于现有的选择)。在code ++工程,但我有因查询数据库中的数和表格的大小糟糕表现。初始布局需要20多秒加载。这是因为在第一离心器是这会导致其他11纺纱来填充,以及布局期间设定为初始选择。使用时纺纱性能也受到影响。如果我去改变第一选择,它需要大约10秒,所有其他的微调器更新。

I have working activity with 12 spinners that are linked to a single database table of over 20,000 records. Each spinner is bound to a different query to make the selections dynamic (based upon the prior selections). The code works but I'm having awful performance due to the number of queries and size of the table in the database. The initial layout takes 20+ seconds to load. That is because the first spinner is set to an initial selection during the layout which causes the 11 other spinners to populate as well. Performance is also affected when using the spinners. If I go to change the first selection, it takes approximately 10 seconds for all the other spinners to update.

应该在哪里我在寻找更好的性能开始?该数据库中的表?查询?或者我应该避免使用12纺纱?

Where should I start in looking for better performance? The database table? The queries? Or should I avoid using 12 spinners?

推荐答案

通过您应该可能考虑去追溯下拉列表中,许多选项。这将允许您分裂查询(每个活动之一),也将让当前目录为占用所有的画面。这样,您也可以为用户筛选当前列表,它可能是必须的,如果你在里面有很多的选项提供了一种方法。

With that many options you should possibly consider going for a drill-down list. This will allow you to split up the queries (one per activity) and will also allow the current list to take up all of the screen. This way you can also provide a way for the user to filter the current list which is probably a must if you have a lot of options in it.

还有:


  • 设置你的布局,然后再开始加载数据。至少在用户等待这个东西的方式出现。

  • 请所有长期运行在的AsyncTask /线程的工作,以避免阻塞UI线程

  • 确保你有你的数据库表一级指标和使用这些查询在可能的情况

  • 请不要一下子所有的数据加载,需要执行只是每次查询

这篇关于提高性能微调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆