News for hackers. Stuff that matters.
Re:Fast nnn file browser v1.6 released by kees99 on Monday December 25, 2017 @10:58AM (#16004520)

  > avoid div instructions in favour of floating point multiply.
  > Is this still faster on recent CPUs?
NB - >>[Taking this question out of context]<< - looks like the answer is "no". From a quick test:

- intel Broadwell: 64-bit integer div is fastest, float div is 69% slower, float mul is 50% slower;

- AMD Ryzen: 64-bit integer div is fastest, float div is 47% slower, float mul is 60% slower;

- ARM11 (Raspberry Zero): 64-bit integer div is fastest, float div is 138% slower, float mul is 159% slower.

quick-and-dirty test used: https://pastebin.com/raw/4XqnuXL5

Re:Fast nnn file browser v1.6 released by apjana on Monday December 25, 2017 @11:07AM (#16004555)
We don't have the case of integer div. And if you take a look into the coolsize() func we don't re-compute the factor. So it's not very significant.

To get the size of a file we multiply only once with this factor.

What is significant is the while() loop where the iterations increase with the file size. There's no mul or div in it giving the API a reasonable performance benefit.