summaryrefslogtreecommitdiff
path: root/src/data.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2020-01-03 17:14:00 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2020-01-03 17:15:44 -0800
commitcadf985cb68a760ef342d61572620cb215cf86fb (patch)
treee27b62837d480907fff649ad5bc23047ec1be6d6 /src/data.c
parent98ab70bc5185e8d767a9076f4f9796c1fa1a9262 (diff)
downloademacs-cadf985cb68a760ef342d61572620cb215cf86fb.tar.gz
emacs-cadf985cb68a760ef342d61572620cb215cf86fb.tar.bz2
emacs-cadf985cb68a760ef342d61572620cb215cf86fb.zip
Let the OS clear new large strings of NUL
On my platform, this sped up (make-string 4000000000 0) from 2.5 to 0.015 seconds (not that people should want to do this much :-). * src/alloc.c (allocate_string_data): New arg CLEARIT. Callers changed. (Fmake_string): Prefer calloc to malloc+memset when allocating a large string of NUL bytes. (make_clear_string): New function. (make_uninit_string): Use it. (make_clear_multibyte_string): New function. (make_uninit_multibyte_string): Use it.
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/data.c b/src/data.c
index 56e363f16b6..c8445e7d874 100644
--- a/src/data.c
+++ b/src/data.c
@@ -2321,7 +2321,7 @@ bool-vector. IDX starts at 0. */)
memcpy (str, SDATA (array), nbytes);
allocate_string_data (XSTRING (array), nchars,
- nbytes + new_bytes - prev_bytes);
+ nbytes + new_bytes - prev_bytes, false);
memcpy (SDATA (array), str, idxval_byte);
p1 = SDATA (array) + idxval_byte;
memcpy (p1 + new_bytes, str + idxval_byte + prev_bytes,