ITeye博客

Java append 二进制大文件的几种方法速度比较

smithfox · 2011-06-09 08:34 · 编程语言 · Markdown

测试环境: Windows7 SP1, 32bit, 4G mem, Intel i5 CPU

 

循环100万次写大约20几个字节, 最终结果:

 

用150K缓存的ByteBuffer和RandomAccessFile写, D:/test2.tmp spent time=177毫秒

用1M缓存的ByteBuffer和RandomAccessFile写, D:/test3.tmp spent time=177毫秒

用150K的mapsize的MappedByteBuffer写, D:/test4.tmp spent time=320毫秒

用150K缓存的OutputStream写, D:/test5.tmp spent time=610毫秒

 

 

更具体内容详见我个人blog:

 

http://www.smithfox.com/?e=149

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。