2 ms·
When it comes to write software when you can write something "faster" in the same time that you can write something slow you should always write it the "faster"
by ChrisCinelli 7y ago
When it comes to write software when you can write something "faster" in the same time that you can write something slow you should always write it the "faster" way. It's Obvious but... not really.
For example when it comes to web development, today most of the people still choose solutions that by default always do diffing of the whole (virtual) DOM to decide what to change in the DOM and server side build ton of object to render HTML and destroy them after the rendering for each request (ex: React). You can argue that the React ecosystem will save you time in writing code because you can find a lot of good reusable components. Yes, but as you code grow, moving to a different framework (ex: Svelte), when and if necessary, is going to be a pretty large job.
You need to pick the right metric. The main one I alway look at is the ROI. Usually I take "user satisfaction and delight" as the "Return" and the time I need to develop the feature in that way as "Investment". The second parameter is usually the risk involved.
If writing it "faster" take 10% more time and is safe may still be worth to go the "faster" way. But when writing something "faster" start taking 200% and more risk is added, you want to be very careful. Is it really worth spending so much time on it?
Fast enough is fast enough.
You do not have to make everything the fastest you can. If a page takes 10 secs to load, what is the advantage for the user if you make it 10x faster? It is a huge win.
What if it loads in 1sec and you make it load in 100ms? Still a win.
But now what if the page takes 100ms to load and you make it 10x faster? Not a lot of people will notice the difference.
And if you have a page that loads in 10ms and you can make 10x faster nobody will even notice it.
So if you like to optimize, go look for places where "10x faster" actually matter.
It is more complicated in practice but keeping these principles in mind will save you a lot of time to work on what really need to be done.
- jcelerier 7y ago> You do not have to make everything the fastest you can. If a page takes 10 secs to load, what is the advantage for the user if you make it 10x faster? The point is not to make it 10x or 100x or 1000x faster, it's to make it so that it is never slower than a monitor frame (e.g. less than 7-8 ms nowadays)