5 ms·
It is quite common that you only need to optimize very small parts of a program to this level. The rest of the program can be written in more conventional style
by antonhag 3y ago
It is quite common that you only need to optimize very small parts of a program to this level. The rest of the program can be written in more conventional styles.
You could of course FFI into e.g. C for those parts, but that is usually harder to maintain than a few well optimized java classes.
- pkolaczk 3y ago> It is quite common that you only need to optimize very small parts of a program to this level. It's a quite common myth developers believe about performance. Hotspots do happen sometimes, but once they have been optimized you quicky end up with a flat profile and an "everything is slow" problem. And in some types of apps, the majority of code is performance critical.
- antonhag 3y agoIt depends - even when you run into an "everything is slow" problem, it might be that it's like 1 endpoint out of 2000 that causes performance issues. In this case, you might need to focus very much on performance for that endpoint, but maybe not for other endpoints. Profilers can help you figure out what code to focus on. If the majority of code is performance critical, the tradeoffs are of course different.
- lmm 3y agoNah, "everything is slow" is vanishingly rare in practice.
- pkolaczk 3y agoDepends on the application. In area of compilers, databases, CAD, game engines, simulation, distributed analytics, machine learning the only code that isn't on the critical path is some configuration / control plane / UI - which is minority of the code.
- lmm 3y agoCertainly not in the entirety of those areas. I've worked in a couple of them and functionality was a higher priority than performance and we picked our tools accordingly.
- saagarjha 3y agoThe cases you’re talking about are the rare ones. Source: I did this professionally and now recreationally.
- generichuman 3y ago> You could of course FFI into e.g. C for those parts, but that is usually harder to maintain than a few well optimized java classes. Hopefully Foreign Function & Memory API [0] makes FFI so much easier that we get to drop down to C without much fuss. [0] https://openjdk.org/jeps/442 https://openjdk.org/jeps/442