mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 19:28:29 +00:00
Make dlmalloc a little faster
This change also documents the libc arena allocator.
This commit is contained in:
parent
fa1e8a3e65
commit
a41669dec6
5 changed files with 59 additions and 19 deletions
|
@ -20,6 +20,7 @@
|
|||
#include "libc/fmt/leb128.h"
|
||||
#include "libc/intrin/lockcmpxchg.h"
|
||||
#include "libc/nexgen32e/crc32.h"
|
||||
#include "libc/runtime/internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "third_party/zlib/zlib.h"
|
||||
|
@ -47,16 +48,7 @@ void *xloadzd(bool *o, void **t, const void *p, size_t n, size_t m, size_t c,
|
|||
int64_t x, y;
|
||||
assert(z == 2 || z == 4);
|
||||
b = q = malloc(m);
|
||||
zs.zfree = 0;
|
||||
zs.zalloc = 0;
|
||||
zs.next_in = p;
|
||||
zs.avail_in = n;
|
||||
zs.total_in = n;
|
||||
zs.avail_out = m;
|
||||
zs.total_out = m;
|
||||
zs.next_out = (void *)q;
|
||||
inflateInit2(&zs, -MAX_WBITS);
|
||||
inflate(&zs, Z_NO_FLUSH);
|
||||
__inflate(q, m, p, n);
|
||||
r = memalign(z, c * z);
|
||||
for (x = i = 0; i < c; ++i) {
|
||||
b += unzleb64(b, 10, &y);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue