[MDEV-17491] micro optimize page_id_t Created: 2018-10-18  Updated: 2023-02-06  Resolved: 2018-10-29

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Fix Version/s: 10.3.11, 10.2.19

Type: Task Priority: Minor
Reporter: Eugene Kosov (Inactive) Assignee: Eugene Kosov (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-23719 Make lock_sys use page_id_t Closed

 Description   

Remove page_id_t::m_fold. This was added as an optimization but my benchmark shows it actually slows things down. http://quick-bench.com/p9tQCIFqk2MJgBrK_vp80YD6r8Y

Updated page_id_t will be consisted of a two uint32_t. It can be transferred in one register in 64 bit platforms. So, pass it by value everywhere.



 Comments   
Comment by Marko Mäkelä [ 2018-10-23 ]

Looks OK, but I’d request some related additional cleanup.
Also, I’d appreciate an example of the generated code for passing `page_id_t` by value on i386, amd64, aarch64. (I would like to confirm that it is only one 64-bit register or two 32-bit registers.)

Comment by Eugene Kosov (Inactive) [ 2018-10-23 ]

amd64: really passed in one `rdi` https://godbolt.org/z/YBAX0e

i686: passed in a stack. And I don't know why https://godbolt.org/z/AZ3L9H

aarch64: I don't know assembly. It looks like a struct was passed on a stack https://godbolt.org/z/q1ucnG

Comment by Eugene Kosov (Inactive) [ 2018-10-24 ]

Cleanup done, PR updated.

Comment by Marko Mäkelä [ 2018-10-29 ]

Thank you! I merged this along with some further cleanup.

Comment by Nikita Malyavin [ 2021-10-03 ]

kevg
>aarch64: I don't know assembly. It looks like a struct was passed on a stack https://godbolt.org/z/q1ucnG

Because it was 32-bit arm

https://godbolt.org/z/GT9999Y5q

Comment by Marko Mäkelä [ 2021-10-04 ]

In 10.5, page_id_t was optimized further to be a wrapper of a single 64-bit integer, so that we can simplify comparisons.

Generated at Thu Feb 08 08:36:52 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.