Java - Store and Upload Arrays to/from Memory to Disk

后端 未结 1 352
自闭症患者
自闭症患者 2021-01-22 20:42

I have an int and float array of length 220 million (fixed). Now, I want to store/upload those arrays to/from memory and disk. Currently, I am using Java NIO\'s FileChannel and

相关标签:
1条回答
  • 2021-01-22 21:30

    If you want to speed up the operation, you can change your code so you are not doing the copy at all. i.e. use the ByteBuffer, or IntBuffer or LongBuffer. This has the benefit of saving a copy into heap of what you off heap already, but also you only load as you use it. i.e. your processing can be concurrent with the loading.

    Using this approach should cut your initial "load" time to around 10 ms, and there is no "save" time because it will already be available to the OS.

    0 讨论(0)
提交回复
热议问题