Timeline for Find nearest k points from the central point
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 27, 2019 at 12:51 | comment | added | Blindman67 |
@thadeuszlay I bench-mark it. I just retested on Chrome 73 and its gotten worse. Comparative results n * n fastest. n is random number. (The following % are percent as fast as best eg 50% is half the speed). Math.pow(n, 2) very close 99% for small ints and same performance for large doubles. n ** 2 is 36% for random large doubles 0 to \$2^{51}\$ and random ints 0 to \$2^{31}\$, and 24% for random small ints 0 to \$2^8\$. On FF all 3 are the same however all are only 20% as fast as Chromes best.
|
|
Mar 27, 2019 at 11:15 | comment | added | thadeuszlay |
Where did you get the info that a ** 2 is slightly slower than a * a ?
|
|
Mar 27, 2019 at 8:28 | vote | accept | thadeuszlay | ||
Mar 27, 2019 at 0:23 | history | edited | Blindman67 | CC BY-SA 4.0 |
added 7 characters in body
|
Mar 27, 2019 at 0:10 | history | edited | Blindman67 | CC BY-SA 4.0 |
added 35 characters in body
|
Mar 27, 2019 at 0:02 | history | answered | Blindman67 | CC BY-SA 4.0 |