Revert the unoptimized changes according to perf benchmarks