1. A method for performing a operation on a main memory, the method comprising: predicting a last write in a fast write cache line, wherein the predicted last write indicates a predicted pattern of the last write cache line before the last write cache line is evicted from a cache memory; comparing the predicted pattern with a pattern of original data bits stored in the main memory for identifying changes to be made in the original data bits; and based on the comparison, determining an optimization operation to be performed on the original data bits, wherein the optimization operation modifies the original data bits based on the predicted pattern before the last write cache line is evicted from the cache memory.