public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: libc-alpha@sourceware.org
Subject: posix_memalign performance regression in 2.38?
Date: Fri, 04 Aug 2023 10:52:44 +0800	[thread overview]
Message-ID: <68e8c4eb66697f2f2cd37bf9456b60aabf7e1bc5.camel@xry111.site> (raw)

Hi,

There seems a performance regression of posix_memalign in Glibc-2.38:

$ cat t.c
#include <stdlib.h>
int main()
{
	void *buf;
	for (int i = 0; i < (1 << 16); i++)
		posix_memalign(&buf, 64, 16);
}
$ cc t.c
$ time ./a.out 

real	0m0.008s
user	0m0.005s
sys	0m0.003s
$ time ~/sources/lfs/glibc-2.38/build/testrun.sh ./a.out 

real	0m4.376s
user	0m4.369s
sys	0m0.007s

The behavior seems worse than quadratic: if I change "1 << 16" to "1 <<
17", I get:

$ time ~/sources/lfs/glibc-2.38/build/testrun.sh ./a.out 

real	0m28.597s
user	0m28.568s
sys	0m0.022s

I've not bisected for this yet.

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

             reply	other threads:[~2023-08-04  2:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-04  2:52 Xi Ruoyao [this message]
2023-08-04 14:12 ` Adhemerval Zanella Netto
2023-08-07 19:49   ` DJ Delorie
2023-08-07 19:57     ` Sam James
2023-08-07 20:15       ` DJ Delorie
2023-08-08  3:38       ` DJ Delorie
2023-08-08  8:08         ` Xi Ruoyao
2023-08-08 15:08           ` DJ Delorie
2023-08-09 10:47           ` Florian Weimer
2023-08-09 16:59             ` Florian Weimer
2023-08-07 19:58     ` Noah Goldstein
2023-08-07 20:07       ` DJ Delorie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=68e8c4eb66697f2f2cd37bf9456b60aabf7e1bc5.camel@xry111.site \
    --to=xry111@xry111.site \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).