lib: merge and optimize gaps
0.4.9