……………………
2021-2-10 07:06:28
The Pareto principle states that for many outcomes roughly 80% of consequences come from 20% of the causes (the “vital few”).
:^(
In computer science the Pareto principle can be applied to optimization efforts.[14] For example, Microsoft noted that by fixing the top 20% of the most-reported bugs, 80% of the related errors and crashes in a given system would be eliminated.[15] Lowell Arthur expressed that "20 percent of the code has 80 percent of the errors. Find them, fix them!"[16] It was also discovered that in general the 80% of a certain piece of software can be written in 20% of the total allocated time. Conversely, the hardest 20% of the code takes 80% of the time. This factor is usually a part of COCOMO estimating for software coding.
你寫code比cpu去執行, 就要對所有運行你啲code既machine付責任
你啲code 浪費左人地1bit, 咁你就係導致人地cpu process額外多呢個冇意義既1 bit既原兇
所以你既責任 R 有一條公式去計(assuming same architecture)
R(M) = b * t
R = R(M0) + R(M1) + R(M2) + ... + R(Mn)
where
M is the machine that runs your crappy code
b is the bit waste that your code causes
t is how many times your code is executed in each machine
R越大 代表你職業生涯裡面浪費既總bit數越多, programmer 要追求R -> 0
有道德既programmer係唔會用4 bytes既data structure 去store 1 bit既information
所以落code前 請計好曬數, 多謝合作
利申: 粗略估算我既R超過GB