Optimize chunk generation