No idea of the algorithm?
Don't over think it
It runs a sim of your character with its current stats, for example it could say you did 500k DPS.
Then it runs a sim of your character with its current stats + 1333 haste, and it say you did 530k DPS.
So according to the sim adding 1333 haste increased your DPS by 30k.
Therefore you stat weight for haste is 30000/1333 = 22.5.
Its all documented here and there are multiple different setting that could be set up to change how the calculation is made
https://github.com/simulationcraft/s...i/StatsScaling