Log Message: |
[Combines r1698359 and r170078 into a single commit for better review.]
Introduce a stream wrapper object that adds buffering support to any
readable stream. Use it on the stdin streams in our CL tools.
As it turns out, parsing data from a stdin byte-by-byte incurs a
massive overhead of 100% internal and 300% system load over a buffered
stream. 'svnadmin load-revprops' sees a 5 times speedup if all data
is in OS disc caches. This is a realistic assumption in a "final sync
and switch over to new repository" scenario.
The other 2 uses of stdin either have less data to process (svnfsfs
load-index) or parse only a small fraction of the stream (svnadmin load).
* subversion/include/svn_io.h
(svn_stream_wrap_buffered_read): Declare the new stream constructor API.
* subversion/libsvn_subr/stream.c
(read_handler_buffering_wrapper,
data_available_handler_buffering_wrapper,
is_buffered_handler_buffering_wrapper): Internal logic of the new
stream object.
(svn_stream_wrap_buffered_read): New constructor implementation.
* subversion/svnadmin/svnadmin.c
(subcommand_load_revprops): Wrap the stdin stream.
* subversion/svnfsfs/load-index-cmd.c
(subcommand__load_index): Same.
* subversion/tests/libsvn_subr/stream-test.c
(struct stream_baton_t,
read_handler,
data_available_handler,
create_test_read_stream): New configurable test read stream.
(expect_line_content,
test_stream_buffered_wrapper): New test for the new wrapper stream.
(test_funcs): Register the new test.
|