3 ms·
In a sense it is, and in a way that is the problem with the current model of JavaScript. That line do an instruction; Is the smallest unit of code executio
by Lerc 11y ago
In a sense it is, and in a way that is the problem with the current model of JavaScript.
That line
do an instruction;
Is the smallest unit of code execution. In JavaScript* that is an event. Let's call it a wibblywoop.
JavaScript is effectively designed around the premise that a wibblywoop takes a negligible amount of time. This premise is false. Oftentimes it does take a negligible amount of time, when it doesn't the impact of responsiveness is severe. This is why everything becomes a callback. The language itself has indicators that this should not be the case. the existence of things like Array.Map shows that there was certainly an intention at some point for a function to be able to do a significant workload and return a result.
* in implementations anyway. The language itself doesn't seem intrinsically bound to the event model.