diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-05-10 00:56:51 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-05-10 00:56:51 +0300 |
commit | 6f34e138f1ecf197212dc1392cbffeea41b44a93 (patch) | |
tree | dce956c487e556e90165f7c48b42a049bd279119 | |
parent | 40f0096ee7b367491248ae5fae093246e0a1a044 (diff) | |
download | micropython-6f34e138f1ecf197212dc1392cbffeea41b44a93.tar.gz micropython-6f34e138f1ecf197212dc1392cbffeea41b44a93.zip |
py/vstr: Change allocation policy, +16 to requested size, instead of *2.
Effect measured on esp8266 port:
Before:
>>> pystone_lowmem.main(10000)
Pystone(1.2) time for 10000 passes = 44214 ms
This machine benchmarks at 226 pystones/second
>>> pystone_lowmem.main(10000)
Pystone(1.2) time for 10000 passes = 44246 ms
This machine benchmarks at 226 pystones/second
After:
>>> pystone_lowmem.main(10000)
Pystone(1.2) time for 10000 passes = 44343ms
This machine benchmarks at 225 pystones/second
>>> pystone_lowmem.main(10000)
Pystone(1.2) time for 10000 passes = 44376ms
This machine benchmarks at 225 pystones/second
-rw-r--r-- | py/vstr.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -151,7 +151,7 @@ STATIC bool vstr_ensure_extra(vstr_t *vstr, size_t size) { if (vstr->fixed_buf) { return false; } - size_t new_alloc = ROUND_ALLOC((vstr->len + size) * 2); + size_t new_alloc = ROUND_ALLOC((vstr->len + size) + 16); char *new_buf = m_renew(char, vstr->buf, vstr->alloc, new_alloc); if (new_buf == NULL) { vstr->had_error = true; |