18 hours has to be put in context. 18 hours doing what? Since you referred specifically to the M2 macbook air, let's look at some numbers.
Yes, the M2 is a relatively high performing chip. Let's push it to its max TDP. At full load, the max TDP should be 20W.[0] Now, the battery is 52.6 watt hours.[1] Thus, at full load, the M2 macbook air should last ~2.63 hrs. That's a fairly generous estimate, since we're assuming both that the processor alone is consuming power, and that the battery is at 100% of manufactured capacity. In reality, the display and possibly the keyboard backlight will also be consuming power.
Bottom line is the M2 can be, as you said, a relatively "high performance" chip. However, it is NOT going to last 18 hours when pushed to its limits. You'll be lucky to get 2.6 hours when taking it to the limit.
[0]: https://www.notebookcheck.net/Apple-M2-Processor-Benchmarks-... [1]: https://www.macworld.com/article/784743/m2-macbook-air-vs-m1...