mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
performance tweak for accumulating large amounts of data into a buffer.
eg. megabytes added in incremets of a few bytes at a time. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35328 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4d638f1cb0
commit
8a605b360a
2 changed files with 15 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
|||
2012-07-30 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSData.m: ([setLength:]) increase size of buffer in chunks
|
||||
proportional to the current size ... so if we add small amounts to a
|
||||
buffer many, many times, we don't reallocate the memory for each tiny
|
||||
increment. Should make accumulating large amounts of data into a
|
||||
buffer much more efficient.
|
||||
|
||||
2012-07-27 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSKeyValueObserving.m:
|
||||
|
|
|
@ -3775,7 +3775,13 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
{
|
||||
if (size > capacity)
|
||||
{
|
||||
[self setCapacity: size];
|
||||
NSUInteger growTo = capacity + capacity / 2;
|
||||
|
||||
if (size > growTo)
|
||||
{
|
||||
growTo = size;
|
||||
}
|
||||
[self setCapacity: growTo];
|
||||
}
|
||||
if (size > length)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue