Threadwell

Recent Notes

  • DemetriSpanos

    Oct 06, 2026

    • archive
    • twitter
    • demetrispanos
  • NOTimothyLottes

    Oct 06, 2026

    • archive
    • twitter
    • notimothylottes
  • bonzajplc

    Oct 06, 2026

    • archive
    • twitter
    • bonzajplc
Home

❯

Archive

❯

Threads

❯

bmcnett

❯

even among performance minded folks, there's a persistent myth that malloc is "pretty fast" when in fact it's so performance hostile that big game productions ban it at link time, to eliminate the damage it causes

even among performance minded folks, there's a persistent myth that malloc is "pretty fast" when in fact it's so performance hostile that big game productions ban it at link time, to eliminate the damage it causes

Properties5
typearchive
sourcetwitter
date2023-12-23
tagsarchive, twitter, bmcnett
descriptioneven among performance minded folks, there's a persistent myth that malloc is "pretty fast" when in fact it's so performance hostile that big game productions ban it at link time, to eliminate the damage it causes

Dec 23, 20231 min read

  • archive
  • twitter
  • bmcnett

Source

  • URL: https://x.com/bmcnett/status/1738591742541414523
  • Author: bmcnett (@bmcnett)
  • Posted: 2023-12-23 16:05:47

Thread

1/ @bmcnett

even among performance minded folks, there’s a persistent myth that malloc is “pretty fast” when in fact it’s so performance hostile that big game productions ban it at link time, to eliminate the damage it causes

Branches: 2023-12-23-SimonWagar-how-can-you-ban-that-at-link-time, 2023-12-23-NOTimothyLottes-perf-enlightment-happens-when-you-no-longer-use, 2023-12-23-MattsPlayCorner-any-performance-minded-person-should-know-that, 2023-12-23-sergei_am-consoles-pc-people-or-current-gen-console-folks, 2023-12-23-tom_forsyth-right-at-the-start-of-a-project-add-a-few-million, 2023-12-23-EskilSteenberg-yes-you-should-use-malloc-sparingly-i-see-a-lot, 2023-12-24-jcoplien-btw-its-usually-not-malloc-that-kills-you-its-free, 2023-12-24-joadnacer-writing-a-reasonably-performant-memory-allocator, 2023-12-25-lectem-malloc-actually-is-pretty-fast-on-most, 2023-12-30-__malkia__-you-need-it-in-tools-its-impossible-to-produce

10 items under this folder.

  • Dec 30, 2023

    @bmcnett You need it in tools, it's impossible to produce good enough tools on time without it (or new/delete).

    • archive
    • twitter
    • bmcnett
  • Dec 25, 2023

    @bmcnett @forked_franz malloc() actually is pretty fast on most implementation.

    • archive
    • twitter
    • bmcnett
  • Dec 24, 2023

    @bmcnett BTW, it's usually not malloc that kills you.

    • archive
    • twitter
    • bmcnett
  • Dec 24, 2023

    @bmcnett writing a reasonably performant memory allocator is incredibly eye opening, the amount of work that can happen for 1 allocation is certainly not something you want in hot paths

    • archive
    • twitter
    • bmcnett
  • Dec 23, 2023

    Yes, you should use malloc sparingly.

    • archive
    • twitter
    • bmcnett
  • Dec 23, 2023

    @bmcnett Any performance minded person should know that any memory allocation is expensive.

    • archive
    • twitter
    • bmcnett
  • Dec 23, 2023

    @bmcnett @SheriefFYI Perf enlightment happens when you no longer use dynamic memory allocation, and thus spend your time complaining about page table related bottlenecks at load time.

    • archive
    • twitter
    • bmcnett
  • Dec 23, 2023

    @bmcnett How can you ban that at link time?

    • archive
    • twitter
    • bmcnett
  • Dec 23, 2023

    @bmcnett Consoles.

    • archive
    • twitter
    • bmcnett
  • Dec 23, 2023

    @bmcnett Right at the start of a project, add a few million clocks of time slug to your malloc() and free() calls and never tell anybody else what you did.

    • archive
    • twitter
    • bmcnett

Created with Quartz v5.0.0 © 2026

  • GitHub