lib: micro-optimizations