[svn:parrot] r46352 - trunk/src/pmc
bacek at svn.parrot.org
bacek at svn.parrot.org
Thu May 6 13:43:52 UTC 2010
Author: bacek
Date: Thu May 6 13:43:51 2010
New Revision: 46352
URL: https://trac.parrot.org/parrot/changeset/46352
Log:
Use very large chunks in StringBuilder.
Modified:
trunk/src/pmc/stringbuilder.pmc
Modified: trunk/src/pmc/stringbuilder.pmc
==============================================================================
--- trunk/src/pmc/stringbuilder.pmc Thu May 6 13:36:47 2010 (r46351)
+++ trunk/src/pmc/stringbuilder.pmc Thu May 6 13:43:51 2010 (r46352)
@@ -211,7 +211,8 @@
strings. So capacity rounded up by next algorithm:
- By 128 bytes if total capacity less then 1KB
- By 1KB if total less than 4KB
- - By 4KB otherwise.
+ - By 4KB if total less than 1MB
+ - By 1MB otherwise.
This function is subject for tuning on real-world usage scenarios.
@@ -230,8 +231,10 @@
total_size = (total_size / 128 + 1) * 128;
else if (total_size < 4096)
total_size = (total_size / 1024 + 1) * 1024;
- else
+ else if (total_size < 1024*1024)
total_size = (total_size / 4096 + 1) * 4096;
+ else
+ total_size = (total_size / 1024 / 1024 + 1) * 1024 * 1024;
return total_size;
}
More information about the parrot-commits
mailing list