Replace the public SVN_STREAM_CHUNK_SIZE constant with an internal one that
we can tweak at will.  Use a 16K chunk size instead of 100K.

The reason for this change is that using 100K buffers doesn't buy us anything
performance-wise.  It also decreases responsiveness in some situations
(for example, you can't cancel an svn cat command between 100K chunks).
See this thread for an indication that a power of 2 actually may increase
performance on a particular platform:
http://svn.haxx.se/dev/archive-2004-11/0123.shtml

Also, note that this value isn't meant to be the optimal buffer size
for file I/O.  Files have their own buffering if needed.

This *may* fix issue #1789: large diff fails on Windows, but I haven't
verified this.

* subversion/include/svn_types.h (SVN_STREAM_CHUNK_SIZE): Deprecate.
  (SVN__STREAM_CHUNK_SIZE): New *internal* macro.  All uses of
  SVN_STREAM_CHUNK_SIZE replace with this macro throughout the code.
Index: subversion/libsvn_fs_base/fs.c
===================================================================
--- subversion/libsvn_fs_base/fs.c	(revision 17584)
+++ subversion/libsvn_fs_base/fs.c	(arbetskopia)
@@ -1141,10 +1141,10 @@
      used by BDB.  See sleepycat docs for details, or svn issue #1818. */
 #ifdef DB_LOG_AUTOREMOVE
   SVN_ERR (get_db_pagesize (&pagesize, src_path, pool));
-  if (pagesize < SVN_STREAM_CHUNK_SIZE)
+  if (pagesize < SVN__STREAM_CHUNK_SIZE)
     {
       /* use the largest multiple of BDB pagesize we can. */
-      int multiple = SVN_STREAM_CHUNK_SIZE / pagesize;
+      int multiple = SVN__STREAM_CHUNK_SIZE / pagesize;
       pagesize *= multiple;
     }
 #else
Index: subversion/include/svn_types.h
===================================================================
--- subversion/include/svn_types.h	(revision 17584)
+++ subversion/include/svn_types.h	(arbetskopia)
@@ -485,13 +485,28 @@
                                       apr_pool_t *pool);
 
 
-/** The maximum amount we (ideally) hold in memory at a time when
+/** A buffer size that may be used when processing a stream of data.
+ *
+ * @note We don't use this constant any longer, since it is considered to be
+ * unnecessarily large.
+ *
+ * @deprecated Provided for backwards compatibility with the 1.3 API.
+ */
+#define SVN_STREAM_CHUNK_SIZE 102400
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+/*
+ * The maximum amount we (ideally) hold in memory at a time when
  * processing a stream of data.
  *
  * For example, when copying data from one stream to another, do it in
  * blocks of this size.
+ *
+ * NOTE: This is an internal macro, put here for convenience.
+ * No public API may depend on the particular value of this macro.
  */
-#define SVN_STREAM_CHUNK_SIZE 102400
+#define SVN__STREAM_CHUNK_SIZE 16384
+#endif
 
 /** The maximum amount we can ever hold in memory. */
 /* FIXME: Should this be the same as SVN_STREAM_CHUNK_SIZE? */
Index: subversion/libsvn_subr/subst.c
===================================================================
--- subversion/libsvn_subr/subst.c	(revision 17584)
+++ subversion/libsvn_subr/subst.c	(arbetskopia)
@@ -1066,13 +1066,13 @@
                         apr_size_t *len)
 {
   struct translated_stream_baton *b = baton;
-  apr_size_t readlen = SVN_STREAM_CHUNK_SIZE;
+  apr_size_t readlen = SVN__STREAM_CHUNK_SIZE;
   apr_size_t unsatisfied = *len;
   apr_size_t off = 0;
   apr_pool_t *iterpool;
 
   iterpool = b->iterpool;
-  while (readlen == SVN_STREAM_CHUNK_SIZE && unsatisfied > 0)
+  while (readlen == SVN__STREAM_CHUNK_SIZE && unsatisfied > 0)
     {
       apr_size_t to_copy;
 
@@ -1089,7 +1089,7 @@
           SVN_ERR (translate_chunk (buf_stream, b->in_baton, b->buf,
                                     readlen, iterpool));
 
-          if (readlen != SVN_STREAM_CHUNK_SIZE)
+          if (readlen != SVN__STREAM_CHUNK_SIZE)
             SVN_ERR (translate_chunk (buf_stream, b->in_baton, NULL, 0,
                                       iterpool));
 
@@ -1193,7 +1193,7 @@
   baton->readbuf_off = 0;
   baton->iterpool = svn_pool_create (baton_pool);
   baton->pool = baton_pool;
-  baton->buf = apr_palloc (baton->pool, SVN_STREAM_CHUNK_SIZE + 1);
+  baton->buf = apr_palloc (baton->pool, SVN__STREAM_CHUNK_SIZE + 1);
 
   /* Setup the stream methods */
   svn_stream_set_read (s, translated_stream_read);
@@ -1216,14 +1216,14 @@
   apr_pool_t *subpool = svn_pool_create (pool);
   apr_pool_t *iterpool = svn_pool_create (subpool);
   struct translation_baton *baton;
-  apr_size_t readlen = SVN_STREAM_CHUNK_SIZE;
-  char *buf = apr_palloc (subpool, SVN_STREAM_CHUNK_SIZE);
+  apr_size_t readlen = SVN__STREAM_CHUNK_SIZE;
+  char *buf = apr_palloc (subpool, SVN__STREAM_CHUNK_SIZE);
 
   /* The docstring requires that *some* translation be requested. */
   assert (eol_str || keywords);
 
   baton = create_translation_baton (eol_str, repair, keywords, expand, pool);
-  while (readlen == SVN_STREAM_CHUNK_SIZE)
+  while (readlen == SVN__STREAM_CHUNK_SIZE)
     {
       svn_pool_clear (iterpool);
       SVN_ERR (svn_stream_read (s, buf, &readlen));
Index: subversion/libsvn_subr/stream.c
===================================================================
--- subversion/libsvn_subr/stream.c	(revision 17584)
+++ subversion/libsvn_subr/stream.c	(arbetskopia)
@@ -209,7 +209,7 @@
                               apr_pool_t *pool)
 {
   apr_pool_t *subpool = svn_pool_create (pool);
-  char *buf = apr_palloc (subpool, SVN_STREAM_CHUNK_SIZE);
+  char *buf = apr_palloc (subpool, SVN__STREAM_CHUNK_SIZE);
   apr_size_t len;
 
   /* Read and write chunks until we get a short read, indicating the
@@ -217,11 +217,11 @@
      associated error.) */
   while (1)
     {
-      len = SVN_STREAM_CHUNK_SIZE;
+      len = SVN__STREAM_CHUNK_SIZE;
       SVN_ERR (svn_stream_read (from, buf, &len));
       if (len > 0)
         SVN_ERR (svn_stream_write (to, buf, &len));
-      if (len != SVN_STREAM_CHUNK_SIZE)
+      if (len != SVN__STREAM_CHUNK_SIZE)
         break;
     }
 
Index: subversion/mod_dav_svn/repos.c
===================================================================
--- subversion/mod_dav_svn/repos.c	(revision 17584)
+++ subversion/mod_dav_svn/repos.c	(arbetskopia)
@@ -2669,9 +2669,9 @@
          ### which will read from the FS stream on demand */
 
       subpool = svn_pool_create (resource->pool);
-      block = apr_palloc(subpool, SVN_STREAM_CHUNK_SIZE);
+      block = apr_palloc(subpool, SVN__STREAM_CHUNK_SIZE);
       while (1) {
-        apr_size_t bufsize = SVN_STREAM_CHUNK_SIZE;
+        apr_size_t bufsize = SVN__STREAM_CHUNK_SIZE;
 
         /* read from the FS ... */
         serr = svn_stream_read(stream, block, &bufsize);
Index: subversion/libsvn_repos/dump.c
===================================================================
--- subversion/libsvn_repos/dump.c	(revision 17584)
+++ subversion/libsvn_repos/dump.c	(arbetskopia)
@@ -189,7 +189,7 @@
   svn_revnum_t oldest_dumped_rev;
 
   /* reusable buffer for writing file contents */
-  char buffer[SVN_STREAM_CHUNK_SIZE];
+  char buffer[SVN__STREAM_CHUNK_SIZE];
   apr_size_t bufsize;
 };
 
Index: subversion/libsvn_repos/load.c
===================================================================
--- subversion/libsvn_repos/load.c	(revision 17584)
+++ subversion/libsvn_repos/load.c	(arbetskopia)
@@ -479,8 +479,8 @@
   svn_stringbuf_t *linebuf;
   void *rev_baton = NULL;
   apr_pool_t *subpool = svn_pool_create (pool);
-  char *buffer = apr_palloc (subpool, SVN_STREAM_CHUNK_SIZE);
-  apr_size_t buflen = SVN_STREAM_CHUNK_SIZE;
+  char *buffer = apr_palloc (subpool, SVN__STREAM_CHUNK_SIZE);
+  apr_size_t buflen = SVN__STREAM_CHUNK_SIZE;
   apr_pool_t *linepool = svn_pool_create (subpool);
   apr_pool_t *revpool = svn_pool_create (subpool);
   apr_pool_t *nodepool = svn_pool_create (subpool);
Index: subversion/libsvn_repos/delta.c
===================================================================
--- subversion/libsvn_repos/delta.c	(revision 17584)
+++ subversion/libsvn_repos/delta.c	(arbetskopia)
@@ -657,11 +657,11 @@
   SVN_ERR (svn_fs_file_contents (&stream1, root1, path1, subpool));
   SVN_ERR (svn_fs_file_contents (&stream2, root2, path2, subpool));
 
-  buf1 = apr_palloc (subpool, SVN_STREAM_CHUNK_SIZE);
-  buf2 = apr_palloc (subpool, SVN_STREAM_CHUNK_SIZE);
+  buf1 = apr_palloc (subpool, SVN__STREAM_CHUNK_SIZE);
+  buf2 = apr_palloc (subpool, SVN__STREAM_CHUNK_SIZE);
   do
     {
-      len1 = len2 = SVN_STREAM_CHUNK_SIZE;
+      len1 = len2 = SVN__STREAM_CHUNK_SIZE;
       SVN_ERR (svn_stream_read (stream1, buf1, &len1));
       SVN_ERR (svn_stream_read (stream2, buf2, &len2));
       
Index: subversion/libsvn_ra_dav/util.c
===================================================================
--- subversion/libsvn_ra_dav/util.c	(revision 17584)
+++ subversion/libsvn_ra_dav/util.c	(arbetskopia)
@@ -537,7 +537,7 @@
   apr_file_t *spool_file;
   svn_stream_t *spool_stream;
   apr_pool_t *subpool = svn_pool_create (pool);
-  char *buf = apr_palloc(subpool, SVN_STREAM_CHUNK_SIZE);
+  char *buf = apr_palloc(subpool, SVN__STREAM_CHUNK_SIZE);
   apr_size_t len;
   
   SVN_ERR( svn_io_file_open(&spool_file, spool_file_name,
@@ -546,11 +546,11 @@
   spool_stream = svn_stream_from_aprfile(spool_file, subpool);
   while (1)
     {
-      len = SVN_STREAM_CHUNK_SIZE;
+      len = SVN__STREAM_CHUNK_SIZE;
       SVN_ERR (svn_stream_read (spool_stream, buf, &len));
       if (len > 0)
         ne_xml_parse(success_parser, buf, len);
-      if (len != SVN_STREAM_CHUNK_SIZE)
+      if (len != SVN__STREAM_CHUNK_SIZE)
         break;
     }
 
