  Photonic resonators allowing to confine the electromagnetic field in
ultra-small volumes and with long decay times are crucial to a number of
applications requiring enhanced nonlinear effects. For applications to
integrated photonic devices on chip, compactness and optimized in-plane
transmission become relevant figures of merit as well. Here we optimize an
encapsulated Si/SiO$_2$ photonic crystal nanobeam cavity at telecom wavelengths
by means of a global optimization procedure, where only the first few holes
surrounding the cavity are varied to decrease its radiative losses. This
strategy allows to achieve close to 10 million intrinsic quality factor,
sub-diffraction limited mode volumes, and in-plane transmission above 65\%, in
a structure with a record small footprint of around $8~\mu$m$^2$. We address
and quantitatively assess the dependence of the main figures of merit on the
nanobeam length and fabrication disorder. Finally, we theoretically give a
realistic estimate of the single-photon nonlinearity in such a device, which
holds promise for prospective experiments in low-power nonlinear and quantum
photonics.
