some optimizations of segment size