performance - Java: get data fast: store in memory vs read from file -


iam writing data table generator tool , have performance problems - need care ram usage , time of generating. key in program.

1) need store final data in single file (one file = 1 table, load later when files generated), like:

111|aaaa|bbba 112|aaab|bbbb 113|aaac|bbbc 114|aaad|bbbd... 

i have many columns , milion of rows. values correct.

2) now, need generate single value next table using values 1 of genereted table. program can save single column temporary file (to read in future), like:

aaaa aaab aaac aaad... 

now, main problem need randomly 'read' new value milion times, same row counter is.

how ? tools use ? have 2 options:

  • store 2nd column 'available values' temporary file in array / arraylist , use eg. .get(int index) method , return value
  • read specific line file , return value

thanks help

how ?

to read file randomly, need know offset of each record. store binary file 4 byte or 8 byte offset start of each line.

you can use library chronicle map allows random read record in file key.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -