summaryrefslogtreecommitdiffstats
path: root/lib.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-01-29 06:28:48 -0800
committerKaz Kylheku <kaz@kylheku.com>2025-01-29 06:28:48 -0800
commitf8658bd4898f415de90f50121afe42a6cad50910 (patch)
tree92d96d0b6e57688f6e8f619170a896842ef4a6dd /lib.h
parentbb71dcaa3ce19ec48d8b352566a21cb1f5f26c2f (diff)
downloadtxr-f8658bd4898f415de90f50121afe42a6cad50910.tar.gz
txr-f8658bd4898f415de90f50121afe42a6cad50910.tar.bz2
txr-f8658bd4898f415de90f50121afe42a6cad50910.zip
build: remove HAVE_MALLOC_USABLE_SIZE.
The malloc_usable_size use in the STR type actually makes operations like string_extend substantially slower. It is faster to store the allocated size locally. Originally, on platforms that have malloc_usable_size, we were able to use the word of memory reclaimed from the string type to store a cached hash code. But that logic was revereted in 2022, so there is no such benefit. * configure (have_malloc_usable_size): Variable removed. Test for the malloc_usable_size function removed. (HAVE_MALLOC_USABLE_SIZE, HAVE_MALLOC_NP): Do not define these preprocessor symbols. * lib.c (HAVE_MALLOC_NP_H): Do not test for this variale to include <malloc_np.h> (string-own, string, string_utf8, mkstring, mkustring, string_extend, string_finish, string_set_code, string_get_code, length_str): Eliminate #ifdefs on HAVE_MALLOC_USABLE_SIZE. * lib.h (struct wstring): Eliminate #ifdef on MALLOC_USABLE_SIZE, so alloc member is unconditionally defined on all platforms.
Diffstat (limited to 'lib.h')
-rw-r--r--lib.h2
1 files changed, 0 insertions, 2 deletions
diff --git a/lib.h b/lib.h
index 66246ea4..af7e6f8e 100644
--- a/lib.h
+++ b/lib.h
@@ -160,9 +160,7 @@ struct string {
obj_common;
wchar_t *str;
val len;
-#if !HAVE_MALLOC_USABLE_SIZE
cnum alloc;
-#endif
};
typedef struct {