Comment

Comment by pkolaczk

In this particular case I find the code optimized for speed (the one using switch) to be also more readable and simpler than the code using virtual dispatch.

The problem with virtual calls in a big project is that there is no good way of knowing what is the target of the call, without some additional tooling like IDE. But in case of a switch/if, it is pretty obvious what the cases are.

parent pkolaczk 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton