How to speed up external merge sort in Java

后端 未结 4 1406
忘掉有多难
忘掉有多难 2021-01-21 05:02

I am writing code for the external merge sort. The idea is that the input files contain too many numbers to be stored in an array so you read some of it and put it into files to

4条回答
  •  悲哀的现实
    2021-01-21 05:51

    I would use memory mapped files. It can be as much as 10x faster than using this type of IO. I suspect it will be much faster in this case as well. The mapped buffers use virtual memory rather heap space to store data and can be larger than your available physical memory.

提交回复
热议问题