Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c++ Subject: Re: speed of unaligned accesses that cross page-boundaries Date: Mon, 18 Apr 2022 20:59:33 -0700 Organization: A noiseless patient Spider Lines: 21 Message-ID: <865yn5afkq.fsf@linuxsc.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="dca78489ef0b00bc0e84cad62da1ae52"; logging-data="8838"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19WBETcp6kw5hHENfUyRSBeGjdDCRpeDo4=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:aIAe2djHKgs2XDnTAfFYyKQ1aVA= sha1:TD99J6uQ/olGvx8eeWX8L6sYhEg= Xref: csiph.com comp.lang.c++:83633 Juha Nieminen writes: > Bonita Montero wrote: > >> I just wanted to measure the performance of unaligned accesses. >> For accesses within a page the difference was below the measurement >> error. Then I read that some processors put a penalty on unaligned >> accesses that cross page-boundaries. So I wrote a little benchmark >> that tries to measure this. But for my PCs, a Ryzen Threadripper >> 3990X, a Ryzen 7 1800X and a Phenom X4 945 all measurements were >> also within the measurement error. > > IIRC both Intel and AMD got rid of the unaligned access penalty > at some point (relatively recently). You would need an older CPU > in order to get the penalty. > > (Btw, I assume you know that unaligned access is standardized as UB.) I assume BM is talking about unaligned access in the actual machine. An access that is unaligned in the actual machine may be an aligned access as far as the abstract machine is concerned.