Performance estimates for applications: An algebraic framework