Need a little more info: What are you running your code on? macOS/Linux/Windows and where? MacBook/RaspberryPi/AWS/Azure, PC/Surface/Laptop? etc. If PC, hat kind of processor, memory and storage are you using?
Also, note that most modern platforms have a startup cost. If, for example, you're running CoreCLR on Windows on a PC, the JIT has to parse the IL of your classes in your assemblies, and compile to machine code before it can execute anything. If your site is using full ASP.NET & MVC, etc., that means it's having to load, parse, compile and then execute the code in several hundred assemblies. This can take some time.
HOWEVER, ~20s to startup a website sounds high: On my Surface Pro 4 Core-i7 with 16GB RAM and a 512GB SSD, running a .NET Core 1.1 ASP.NET MVC site generated via Yeoman
- First-hit takes 2756.8643ms to execute the HomeController.Index() method, and 3056.1864ms to complete the request.
- Second hit takes 11.7073ms to execute the HomeController.Index() method, and 46.4979ms to complete the request.
- Fifth hit takes 24.7564ms to execute the HomeController.Index() method, and 3.858msto complete the request.
There's a reason any responsible tester/benchmarker always runs a test suite 2-3 times before running the recorded run: This makes sure everything is compiled, CPU/memory/server/DB/disk caches are full, etc.
My guess is that you're running a machine with a spinning hard-drive which is MASSIVELY slower than an SSD. If so, I'd encourage you to replace your HDD with a half decent SSD which are increasingly affordable these days and will likely result in your PC demonstrating MASSIVE performance & responsiveness improvements.