I am using the following code to get the Web Application object in SharePoint 2013. But this is causing some performance issues. Does anyone know of a better approach? Please help.
SPWebApplication spWebApp = SPWebService.ContentService.WebApplications.SingleOrDefault(wa => wa.Name == SPConstants.SPWEBAPP_NAME); // Assuming Web Application on Port 80 will have the same name across environments