diff options
author | nyamatongwe <devnull@localhost> | 2001-04-25 01:20:44 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2001-04-25 01:20:44 +0000 |
commit | a8436cea2a59cce5dc3b090967e5913c08196586 (patch) | |
tree | dc78f7083d7dbaac0309812a68bbd7a2bffd4cb0 /src/CellBuffer.cxx | |
parent | 7e11fe32578b12b2a48419fd3f4d2bbfe92d53d5 (diff) | |
download | scintilla-mirror-a8436cea2a59cce5dc3b090967e5913c08196586.tar.gz |
Changed buffer growth strategy to be proportional to current size by doubling
gowth size whenever the buffer size is more than 4 times the buffer size.
Reduced load of 10 Meg file from 12 to 4 seconds and 30 Meg file from 1000
to 21 seconds.
Reformatting.
Diffstat (limited to 'src/CellBuffer.cxx')
-rw-r--r-- | src/CellBuffer.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index 3e9f0e7b7..56dd27ea0 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -597,6 +597,7 @@ CellBuffer::CellBuffer(int initialLength) { part2body = body + gaplen; readOnly = false; collectingUndo = true; + growSize = 4000; } CellBuffer::~CellBuffer() { @@ -627,7 +628,9 @@ void CellBuffer::RoomFor(int insertionLength) { if (gaplen <= insertionLength) { //Platform::DebugPrintf("need room %d %d\n", gaplen, insertionLength); GapTo(length); - int newSize = size + insertionLength + 4000; + if (growSize * 4 < size) + growSize *= 2; + int newSize = size + insertionLength + growSize; //Platform::DebugPrintf("moved gap %d\n", newSize); char *newBody = new char[newSize]; memcpy(newBody, body, size); |