mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-24 03:20:30 +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
|
@ -66,7 +66,7 @@ __gc: .ftrace2
|
|||
|
||||
// if this code fails
|
||||
// check if CosmoTib's size changed
|
||||
sub x8,x28,#192 // __get_tls()
|
||||
sub x8,x28,#512 // __get_tls()
|
||||
ldr x9,[x8,0x18] // tib::garbages
|
||||
ldr x10,[x9] // g->i
|
||||
ldr x8,[x9,8] // g->p
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue