Skip to content

Commit

Permalink
Merge pull request #9578 from tinwelint/3.2-faster-tocsv
Browse files Browse the repository at this point in the history
Much faster to-csv in QuickImport due to buffered output
  • Loading branch information
tinwelint committed Jun 29, 2017
2 parents a5f0d6c + 5f2022b commit f717034
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
*/
package org.neo4j.tooling;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.function.Function;
Expand All @@ -33,6 +35,8 @@
import org.neo4j.unsafe.impl.batchimport.input.csv.Deserialization;
import org.neo4j.unsafe.impl.batchimport.input.csv.Header;

import static org.neo4j.io.ByteUnit.mebiBytes;

public class CsvOutput implements BatchImporter
{
private final File targetDirectory;
Expand Down Expand Up @@ -141,6 +145,7 @@ private void serialize( PrintStream out, Header header )

private PrintStream file( String name ) throws IOException
{
return new PrintStream( new File( targetDirectory, name ) );
return new PrintStream( new BufferedOutputStream( new FileOutputStream( new File( targetDirectory, name ) ),
(int) mebiBytes( 1 ) ) );
}
}

0 comments on commit f717034

Please sign in to comment.