mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-03 09:48:29 +00:00
Make dlmalloc 2.4x faster for multithreading
This change adds a TLS freelist for small dynamic memory allocations. Cosmopolitan's TIB is now 512 bytes in size. Single-threaded malloc() performance isn't impacted by this, until pthread_create() is called. Single-threaded programs may also want to consider using: #include "libc/mem/tinymalloc.inc" Which will shave 30k off the executable size and sometimes go faster.
This commit is contained in:
parent
deaef81463
commit
07cef612c3
9 changed files with 150 additions and 6 deletions
|
@ -29,7 +29,7 @@ COSMOPOLITAN_C_START_
|
|||
#define errno \
|
||||
(*__extension__({ \
|
||||
errno_t *__ep; \
|
||||
__asm__("sub\t%0,x28,#192-0x3c" : "=r"(__ep)); \
|
||||
__asm__("sub\t%0,x28,#512-0x3c" : "=r"(__ep)); \
|
||||
__ep; \
|
||||
}))
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue