What is data alignment? Optimality, efficiency and safety | Top-Up C++ [C++ #01]
Vložit
- čas přidán 22. 07. 2024
- #Cpp #alignment
Check out the related article on TheWolfSound.com: thewolfsound.com/what-is-data...
Sign up for WolfSound's newsletter: thewolfsound.com/newsletter/
Please subscribe to WolfSound to let the little Wolf grow:
/ @wolfsoundaudio
Address alignment with respect to some power of 2 relates to this address modulo 2 to that power. Datum alignment relates to whether a particular datum lies at an aligned address.
In this video I am explaining how to take advantage of proper data alignment. To present the full picture, I am introducing the relevant C++ features.
00:00 Introduction
00:42 Address alignment
01:16 Datum alignment
02:58 Addess vs datum alignment
03:20 Alignment requirement
04:10 Handling alignment (with examples)
08:32 C++ alignment features
12:00 Is alignment necessary for software optimality?
13:07 Summary
Reference:
[1] Article about alignment in Microsoft Docs: docs.microsoft.com/en-us/cpp/... Access: 09.04.2020
[2] en.cppreference.com/w/cpp/lan... Access: 09.04.2020
[3] Excerpt from the "Power and Performance in Enterprise Systems" 2015, Pages 263-273: www.sciencedirect.com/topics/... Access: 09.04.2020
[4] Alignment optimality discussion: lemire.me/blog/2012/05/31/dat... Access: 09.04.2020
[5] std::alignment_of vs. alignof: stackoverflow.com/questions/3... Access: 09.04.2020
The video contains a short clip from "The Lord of the Rings: The Fellowship of the Ring" (2001) directed by Peter Jackson and produced by New Line Cinema.
All the copyrights belong to their respective owners. Copyright Disclaimer under Section 107 of the Copyright Act 1976, allowance is made for "fair use" for purposes such as criticism, comment, news reporting, teaching, scholarship, and research. Fair use is a use permitted by copyright statute that might otherwise be infringing. Non-profit, educational or personal use tips the balance in favor of fair use. - Věda a technologie
Have I helped you with this video? If yes, please, consider buying me a ☕ coffee at www.buymeacoffee.com/janwilczek
Thanks! 🙂
nah ... its just reading stuff video and not enough code examples. Pretty ordinary content and mostly reading from script. Avoid coffee anyway. Drink water. Its healthy
@@testshar2117 Thank you for the feedback, I'm sorry you didn't benefit from it ;) If you have any more suggestions to improve the content, then please share them with me!
@@WolfSoundAudio all the alignment macros/templates/functions you summarized , it will help to have code examples giving more details about use case and it's usage.
@@testshar2117 Ok, thanks :)
I really liked this video, please keep posting videos like these!
I had no idea about this topic until I watched this video.
Great stuff all around!!! Studying C now, and this is a great explanation!
Thank you!!! I really mean that.
Thanks, that's great to hear!
Amazing explanation. You touched on it in a deeper way than I saw others do. It really clicked here. Please keep doing videos!
Thanks, I'm happy to hear that!
great video! explained a lot better than my textbook could and in less time too.
Really good explanation for a topic that's been bugging me for a while. You got yourself a subscriber. The quality of the mic may need to be improved though :). Otherwise really good video
Nice explanation
Amazing explanation, thank you.
Thanks for the feedback!
Really good explanation, keep up!
Thank you, glad you found it useful!
Nice ^^
It will be good if you provide example for each keyword.
I did understand concept of alignment while watching this video, so it's half of success.
But I still don't know how to force my structs to be alignment.
Thanks for the remark! I may do a follow-up video which would include code examples to clarify these concepts.
thanks you... :)
Glad you like it!
nice
Thanks! :)
Wow... It hurts 😅
Haha, no! :D Have you seen my most recent video on the topic? There is an even simpler explanation :)