Hacker News new | ask | show | jobs
by theamk 966 days ago
"this task" is complex mathematical calculation ("Jensen Shannon divergence") and a large fraction of speedup is from replacing exact methods with approximate ones.. full 32-bit floats become 16-bit ones, exact logarithm is replaced by approximation of one, division is replacing with reciprocal + multiply...

It's an interesting question: can computer do that same thing automatically? Can we somehow tell the compiler: "this variable's interesting range is 1-100 and I only need 10LSBs of precision.. feel free to optimize under those assumption"?