Optimizing cache initialization by sorting characters by size