diff options
| author | Paul Eggert | 2020-01-03 17:14:00 -0800 |
|---|---|---|
| committer | Paul Eggert | 2020-01-03 17:15:44 -0800 |
| commit | cadf985cb68a760ef342d61572620cb215cf86fb (patch) | |
| tree | e27b62837d480907fff649ad5bc23047ec1be6d6 /src/lisp.h | |
| parent | 98ab70bc5185e8d767a9076f4f9796c1fa1a9262 (diff) | |
| download | emacs-cadf985cb68a760ef342d61572620cb215cf86fb.tar.gz 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/lisp.h')
| -rw-r--r-- | src/lisp.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lisp.h b/src/lisp.h index 36bb79d67e1..9be7bfec5c0 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3812,7 +3812,8 @@ extern void parse_str_as_multibyte (const unsigned char *, ptrdiff_t, | |||
| 3812 | /* Defined in alloc.c. */ | 3812 | /* Defined in alloc.c. */ |
| 3813 | extern void *my_heap_start (void); | 3813 | extern void *my_heap_start (void); |
| 3814 | extern void check_pure_size (void); | 3814 | extern void check_pure_size (void); |
| 3815 | extern void allocate_string_data (struct Lisp_String *, EMACS_INT, EMACS_INT); | 3815 | extern void allocate_string_data (struct Lisp_String *, EMACS_INT, EMACS_INT, |
| 3816 | bool); | ||
| 3816 | extern void malloc_warning (const char *); | 3817 | extern void malloc_warning (const char *); |
| 3817 | extern AVOID memory_full (size_t); | 3818 | extern AVOID memory_full (size_t); |
| 3818 | extern AVOID buffer_memory_full (ptrdiff_t); | 3819 | extern AVOID buffer_memory_full (ptrdiff_t); |