Paul Eggert wrote: > I fixed the performance > bug by installing the attached patch, which simply prefers > posix_memalign to mmap.
Most platforms nowadays have posix_memalign: glibc, musl, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Solaris, Cygwin, Android. Those which don't have it: native Windows. Still, it would be interesting to measure how much wasted allocation posix_memalign() does on the various platforms. IMO, the scaling problem comes from using a linked list. For solving that, I would suggest to use one of the container types: https://www.gnu.org/software/gnulib/manual/html_node/Ordinary-containers.html > Although we could instead (or also) try to optimize the mmap (or even > the malloc) cases I wonder whether it's worth the hassle nowadays. More > likely there are platforms where using C11-style aligned_alloc would be > a performance win. That would be easy to add, if there's a need. aligned_alloc won't help here: On the platforms without posix_memalign (namely, native Windows, see above), we don't have an aligned_alloc implementation. See https://www.gnu.org/software/gnulib/manual/html_node/aligned_005falloc.html Bruno
