David Barr <david.barr@cordelta.com>


Patch
r1003924

r1003924 | artagnon | 2010-10-03 07:05:05 +0000 (Sun, 03 Oct 2010)

svnrdump: dump_editor: Use just one temporary file for all textdelta
application by truncating and re-using it in each iteration. This has
significant performance benefits.

* subversion/svnrdump/dump_editor.c

  (dump_edit_baton): Correct the comment about the description of
  pool, add a new delta_file variable and note in a comment that
  delta_file and delta_abspath should be allocated in the
  per-edit-session pool, not in the per-revision pool like the other
  variables. 

  (get_dump_editor): Open the delta file initializing `eb->delta_file`
  and `eb->delta_abspath`, allocating them in the per-edit-session
  pool. Mark delta_file as a del_on_close, so that it's automatically
  cleaned up when the editor is done. All streams in callbacks that
  map to it should set disown = TRUE.

  (close_file): Instead of opening the delta_file, simply seek to the
  beginning. During cleanup, don't close or remove the file; just
  truncate it to get it ready for the next textdelta
  application. Also, while getting the file stat, don't re-open the
  file -- use apr_file_info_get on the open file instead.

  (apply_textdelta): Don't create a unique file. Simply map a stream
  to the delta file to perform the textdelta application. Disown the
  stream and close it explicitly, making sure not to close the delta
  file itself.

Patch by: David Barr <david.barr@cordelta.com>
Helped by: artagnon