Reduce the size of Node by 8 bytes on 64bit with gcc/clang compilers
Reduce the size of Node by 8 bytes on 64bit with gcc and clang compilers (from 72 bytes to 64 bytes) by altering the order of its parent classes. The TreeShared<Node> parent class now comes last because it contains only 1 member (in release) which is an int and the first member of Node is a uint32_t. This way no padding is added by gcc/clang and these two members will use the same word in memory. MSVC likely won't get any benefit from this because it makes sure each class in the hierarchy is memory-aligned (see "Compiler being used" section in [1]). There should be no size impact for MSVC. [1] http://www.cprogramming.com/tutorial/size_of_class_object.html R=esprehn@chromium.org Review URL: https://codereview.chromium.org/326793002 git-svn-id: svn://svn.chromium.org/blink/trunk@175844 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Showing
Please register or sign in to comment