Fast CSV parsing

前端 未结 9 1373
名媛妹妹
名媛妹妹 2020-11-28 10:25

I have a java server app that download CSV file and parse it. The parsing can take from 5 to 45 minutes, and happens each hour.This method is a bottleneck of the app so it\'

9条回答
  •  青春惊慌失措
    2020-11-28 11:11

    The problem of your code is that it's using replaceAll and split which are very costly operation. You should definitely consider using a csv parser/reader that would do a one pass parsing.

    There is a benchmark on github

    https://github.com/uniVocity/csv-parsers-comparison

    that unfortunately is ran under java 6. The number are slightly different under java 7 and 8. I'm trying to get more detail data for different file size but it's work in progress

    see https://github.com/arnaudroger/csv-parsers-comparison

提交回复
热议问题