Home > Mobile >  [for] how arraylist optimization under the large amount of data?
[for] how arraylist optimization under the large amount of data?

Time:09-22

Software is doing on the instrument (android 4.4.4, 2 gb of memory, custom ROM), there is a demand every 0.1 s a temperature data and draw line diagram, according to data based on point (float x, float y) in the form of on the inside of the arraylist,

 public class TempValue implements Serializable {

Private static final long serialVersionUID=3939262894532808919 l;
Private List Valus=new ArrayList (a);

Public TempValue () {
super();
}
.
}


A total of 24 such list under full load operation, the current approach is based on the list [6] [4] two-dimensional array storing
TempValue=https://bbs.csdn.net/topics/new TempValue TempValue [] [] [6] [4].
The 24 channels can switch and view the data,

Question is if the program is running time is short there is no problem, but if you're running more than 8 hours, there will be data of 8 * 3600 * 10 * 24 will cause caton interface, graph set is refresh every 333 ms,
Because every time to hold large amounts of data (other data have, but they are mainly temperature data), the interface will be caton, opens at interface directly with animation "procedure not response"

Everyone a great god, and what method can be optimized?

CodePudding user response:

First of all, the data saved to the local database,
Assuming full screen can display 10 data,
First of all, let's take the current 10 to the database, article 20 (if any) before and after 20
Listening sliding, if slipped 10 curve to the left, then go to the database and take 10, the curve after 10 to delete, and so on, right row in the same way,

This is the reuse mechanism, recyclerview, listview is according to this principle
  • Related