Take the following case
uint256 x = z * 100/1000;//1st statement
uint256 y = z * 1/10;// 2nd statement
uint256 superOptimized = z /10;
///special cases z * 4/3 or any other number with rounding error or NaN
///z = uint256::MAX
/***********
As you can see all statements are essentially doing the same thing
***********/
I am coming from an Embedded Engineers perspective at this problem. Depeding on the Microprocesor/Cpu/Microcontroller architecture
More computational resources such as memory/machinecycles are spent on the first statement if the Optimization was handled simply by the CPU at runtime or prior to execution.
If a OS is involved still everything falls back on CPU.
Suppose this code was compiled using a different computer with a Compiler and Language features a Smart language or Compiler will recognize that the unit on the right hand side is the same so both statements are equals in terms of resources. So in Assembly first and second code is outputted as the same.
This example shows that people building popular compilers or creating a new language must have known about this patterns.
My gist of the question beginning from C upto javascript, rust, python and solidity are these arithmatic optimizations as mentioned in Point 4 implemented in language level or compiler level in modern programming languages and to what extent. This may come off as an opinion based question but I was curious about what language/compiler combination produces best optimizations in Computing arithmatic operations.