Skip to content

mimalloc#61094

Open
jason1987d wants to merge 6 commits into
void-linux:masterfrom
jason1987d:mimalloc
Open

mimalloc#61094
jason1987d wants to merge 6 commits into
void-linux:masterfrom
jason1987d:mimalloc

Conversation

@jason1987d

@jason1987d jason1987d commented Jun 17, 2026

Copy link
Copy Markdown
Contributor
  • mimalloc: update to 3.3.2.
  • ART: revbump for mimalloc update build.
  • MoarVM: revbump for mimalloc update build.
  • mold: revbump for mimalloc update build.
  • rakudo: revbump for mimalloc update build.
  • nqp: revbump for mimalloc update build.

Testing the changes

  • I tested the changes in this PR: YES

Local build testing

  • I built this PR locally for my native architecture, x86_64-libc

How I tested this code:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

#include <mimalloc.h>

#ifndef N
#define N 10000000   // number of allocations
#endif

#ifndef SIZE
#define SIZE 64       // bytes per allocation
#endif

// to compile:
// gcc test_mimalloc.c -O2 -o test_mimalloc -lmimalloc

static double now_sec() {
    struct timespec ts;
    clock_gettime(CLOCK_MONOTONIC, &ts);
    return ts.tv_sec + ts.tv_nsec * 1e-9;
}

static void run_test(const char* name, int use_mimalloc) {
    void** ptrs = malloc(sizeof(void*) * N);

    double start = now_sec();

    for (int i = 0; i < N; i++) {
        if (use_mimalloc)
            ptrs[i] = mi_malloc(SIZE);
        else
            ptrs[i] = malloc(SIZE);

        // touch memory to avoid lazy effects
        memset(ptrs[i], i & 0xFF, SIZE);
    }

    for (int i = 0; i < N; i++) {
        if (use_mimalloc)
            mi_free(ptrs[i]);
        else
            free(ptrs[i]);
    }

    double end = now_sec();

    printf("%s: %.3f sec (%d allocs of %d bytes)\n",
           name, end - start, N, SIZE);

    free(ptrs);
}

int main() {
    printf("Mimalloc benchmark\n");
    printf("N=%d SIZE=%d bytes\n\n", N, SIZE);

    run_test("mimalloc", 1);

    return 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant