There are several things to consider for efficient code
- The developer's knowledge, with limited knowledge one can not know what to look for and there is no tried and true pattern that works for every application in regards to code.
- What type of project, the environment and hardware.
- Knowing the cost of using any framework homebrewed or third party
- Using libraries such as Benchmarkdotnet to bench mark code
- Load testing which we do on all web applications that are outfacing to the entire state of Oregon
- Measure app performance in Visual Studio
And one must not just started coding with only a vision, write out your requirements, work in iterations and with each task in a iteration check performance along with writing unit test.
Something I do is not always look for one-liners or libraries that promise this and that without knowing what their footprint is.