[go: up one dir, main page]

Today I Learned

tags


2023/06/19

That Option<T> costs ~1x the alignment value of T. I also learned Vec<T>’s size and alignment don’t reflect the size and alignment of T since the Vec is tracking an owned buffer on the heap which isn’t counted in the Vec’s own size.

struct Alone8(u8);         // size= 1, align=1
struct Opt8(Option<u8>);   // size= 2, align=1
struct Vec8(Vec<u8>);      // size=24; align=8

struct Alone64(u64);       // size= 8, align=8
struct Opt64(Option<u64>); // size=16, align=8
struct Vec64(Vec<u64>);    // size=24; align=8

That Firefox bundles process and task managers for performance monitoring, available at about:processes and about:tasks, respectively https://support.mozilla.org/en-US/kb/task-manager-tabs-or-extensions-are-slowing-firefox