Minor performance tweak.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21214 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2005-05-11 08:14:32 +00:00
parent 1f6838a95c
commit 915a739931
2 changed files with 13 additions and 4 deletions

View file

@ -1,3 +1,11 @@
2005-05-11 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSFileHandle.m: Increase size of buffer for incoming data ...
on modern systems we have more memory and a bugger buffer can make
a significant performance improvement when reading large amounts of
streamed data. New define of READ_SIZE for this buffer ... easily
adjusted in one place.
2005-05-10 Richard Frith-Macdonald <rfm@gnu.org> 2005-05-10 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/AGSHtml.h: * Tools/AGSHtml.h:

View file

@ -101,6 +101,7 @@
// Maximum data in single I/O operation // Maximum data in single I/O operation
#define NETBUF_SIZE 4096 #define NETBUF_SIZE 4096
#define READ_SIZE NETBUF_SIZE*10
static GSFileHandle* fh_stdin = nil; static GSFileHandle* fh_stdin = nil;
static GSFileHandle* fh_stdout = nil; static GSFileHandle* fh_stdout = nil;
@ -1381,7 +1382,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
- (NSData*) availableData - (NSData*) availableData
{ {
char buf[NETBUF_SIZE]; char buf[READ_SIZE];
NSMutableData* d; NSMutableData* d;
int len; int len;
@ -1417,7 +1418,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
- (NSData*) readDataToEndOfFile - (NSData*) readDataToEndOfFile
{ {
char buf[NETBUF_SIZE]; char buf[READ_SIZE];
NSMutableData* d; NSMutableData* d;
int len; int len;
@ -1467,7 +1468,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
} }
else else
{ {
char buf[NETBUF_SIZE]; char buf[READ_SIZE];
d = [NSMutableData dataWithCapacity: 0]; d = [NSMutableData dataWithCapacity: 0];
do do
@ -2151,7 +2152,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
NSMutableData *item; NSMutableData *item;
int length; int length;
int received = 0; int received = 0;
char buf[NETBUF_SIZE]; char buf[READ_SIZE];
item = [readInfo objectForKey: NSFileHandleNotificationDataItem]; item = [readInfo objectForKey: NSFileHandleNotificationDataItem];
/* /*