DEV Community

Discussion on: The costs of Optional Chaining.

Collapse
 
smeijer profile image
Stephan Meijer

You're right. It's definitely the polyfill causing this. In the jsperf link I've posted, you can also see that I did compare it with idx. And both have this issue. Idx does keep the transpiled code a bit smaller though.

We could create something very smart by using proxies and getters, but that will have a serious performance impact in return.

Unfortunately, it will take a long time before we don't need the babel transform any more (or any other polyfill). So at least for now, the issue is quite real. Even though the real cause is the transpiler and not the syntax itself.