  The Knill-Laflamme (KL) conditions distinguish exact quantum error correction
codes, and it has played a critical role in the discovery of state-of-the-art
codes. However, the family of exact codes is a very restrictive one and does
not necessarily contain the best-performing codes. Therefore, it is desirable
to develop a generalized and quantitative performance metric. In this Letter,
we derive the near-optimal channel fidelity, a concise and optimization-free
metric for arbitrary codes and noise. The metric provides a narrow two-sided
bound to the optimal code performance, and it can be evaluated with exactly the
same input required by the KL conditions. We demonstrate the numerical
advantage of the near-optimal channel fidelity through multiple qubit code and
oscillator code examples. Compared to conventional optimization-based
approaches, the reduced computational cost enables us to simulate systems with
previously inaccessible sizes, such as oscillators encoding hundreds of average
excitations. Moreover, we analytically derive the near-optimal performance for
the thermodynamic code and the Gottesman-Kitaev-Preskill (GKP) code. In
particular, the GKP code's performance under excitation loss improves
monotonically with its energy and converges to an asymptotic limit at infinite
energy, which is distinct from other oscillator codes.
