mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Make realloc() go 100x faster on Linux/NetBSD
Cosmopolitan now supports mremap(), which is only supported on Linux and NetBSD. First, it allows memory mappings to be relocated without copying them; this can dramatically speed up data structures like std::vector if the array size grows larger than 256kb. The mremap() system call is also 10x faster than munmap() when shrinking large memory mappings. There's now two functions, getpagesize() and getgransize() which help to write portable code that uses mmap(MAP_FIXED). Alternative sysconf() may be called with our new _SC_GRANSIZE. The madvise() system call now has a better wrapper with improved documentation.
This commit is contained in:
parent
196942084b
commit
f7780de24b
71 changed files with 1301 additions and 640 deletions
|
@ -43,6 +43,7 @@ int unsetenv(const char *) libcesque;
|
|||
int clearenv(void) libcesque;
|
||||
void fpreset(void) libcesque;
|
||||
void *mmap(void *, uint64_t, int32_t, int32_t, int32_t, int64_t) libcesque;
|
||||
void *mremap(void *, size_t, size_t, int, ...) libcesque;
|
||||
int munmap(void *, uint64_t) libcesque;
|
||||
int mprotect(void *, uint64_t, int) libcesque;
|
||||
int msync(void *, size_t, int) libcesque;
|
||||
|
@ -54,6 +55,7 @@ char *getlogin(void) libcesque;
|
|||
int getlogin_r(char *, size_t) libcesque;
|
||||
int login_tty(int) libcesque;
|
||||
int getpagesize(void) pureconst libcesque;
|
||||
int getgransize(void) pureconst libcesque;
|
||||
int syncfs(int) dontthrow libcesque;
|
||||
int vhangup(void) libcesque;
|
||||
int getdtablesize(void) libcesque;
|
||||
|
@ -127,7 +129,6 @@ void GetCpuidBrand(char[13], uint32_t) libcesque;
|
|||
long __get_rlimit(int) libcesque;
|
||||
const char *__describe_os(void) libcesque;
|
||||
long __get_sysctl(int, int) libcesque;
|
||||
int __granularity(void) pureconst libcesque;
|
||||
int __get_arg_max(void) pureconst libcesque;
|
||||
int __get_cpu_count(void) pureconst libcesque;
|
||||
long __get_avphys_pages(void) pureconst libcesque;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue