Does compiling PETSc with an external BLAS/LAPACK library significantly affect performance on sparse matrices, or does it only use those libraries for dense matrix math?
PETSc uses BLAS for a few vector primitives, but these are generally limited by memory bandwidth and there isn't much variance in "optimization", so it tends not to make much performance difference.
It also uses Lapack for some analysis such as Lanczos or Arnoldi estimates of eigenvalues and singular values, but these are generally not performance-sensitive.
Dense "level 3" operations generally only appear in a performance-sensitive context when using sparse direct solvers from third-party libraries (e.g. MUMPS, SuperLU, UMFPACK), in which case fill eventually leads to dense problems that are large enough to benefit from calling BLAS.
If you rely on these sparse direct solvers applied to large problems, then it's worth building with a tuned BLAS implementation, otherwise it makes very little difference.