
Fast nnn file browser v1.6 released - apjana
https://github.com/jarun/nnn/releases/tag/v1.6
======
kees99
There is this (much older) piece of software that does much of what nnn/noice
do, and more:

[https://en.wikipedia.org/wiki/Midnight_Commander](https://en.wikipedia.org/wiki/Midnight_Commander)

~~~
janekm
They claim higher performance for nnn than mc. Not sure it’s really needed in
most cases though... but nnn could come in handy in edge cases of really large
directories, say. BTW their docs say that they avoid div instructions in
favour of floating point multiply. Is this still faster on recent CPUs?

~~~
apjana
I can't be very specific without citing examples. The following APIs may
explain what I mean:

[https://github.com/jarun/nnn/blob/master/nnn.c#L358](https://github.com/jarun/nnn/blob/master/nnn.c#L358)

[https://github.com/jarun/nnn/blob/master/nnn.c#L1267](https://github.com/jarun/nnn/blob/master/nnn.c#L1267)

[https://github.com/jarun/nnn/blob/master/nnn.c#L1617](https://github.com/jarun/nnn/blob/master/nnn.c#L1617)

Most of the functions in nnn are targeted to be high-performance like these.

~~~
fredericoqq
Hmm. I'm not convinced any of your routines are more "high-performance" than
the standard-library, have you benchmarked them?

For example, I don't think your getorder() could possibly be faster than
__builtin_ctz(), or even a wrapper around ffs(). You also hardcoded the size
of size_t to 32 bits, so it's not more portable than those options.

Edit: I checked, ffs is a tiny branch-free routine in glibc:

    
    
      (gdb) disassemble ffs
       Dump of assembler code for function ffsl:
          0x0007e9d0 <+0>:	mov    $0xffffffff,%edx
          0x0007e9d5 <+5>:	bsf    0x4(%esp),%eax
          0x0007e9da <+10>:	cmove  %edx,%eax
          0x0007e9dd <+13>:	add    $0x1,%eax
          0x0007e9e0 <+16>:	ret    
       End of assembler dump.

~~~
apjana
> __builtin_ctz

avoided it to stay out of compiler-specific stuff. we do have plans to replace
getorder() with ffsl().

Perhaps I would be more accurate if I say nnn is faster by design. Movement of
data around memory is minimal. No redundant bytes are allocated. We use
quicksort and optimize further by pushing non-matches down right away so they
never appear in a filter comparison again. And of course, using non-lib custom
functions enable using static linkage, having a controlled binary size and
removing redundant checks/processing because the limits and borderline cases
are known.

------
ciupicri
Have you thought of using COPR[1] to provide builds for Fedora and RHEL? I'm
asking because I noticed you provide a RPM only for Fedora 26; Fedora 27 is
missing.

[1]: [https://copr.fedorainfracloud.org](https://copr.fedorainfracloud.org)

~~~
apjana
We use PackageCore which integrates well with Travis CI. Fedora 27 is not
added to PackageCore yet.

Does COPR integrate with Travis?

------
li4ick
"The missing terminal file browser for X"??? What about ranger?

~~~
apjana
probably lost in the forest chased by a python... ;)

------
Jare
No Windows version, I'll keep using (shameless plug) my minimal but useful
[https://github.com/TheJare/jm](https://github.com/TheJare/jm)

~~~
apjana
Sorry about that. I don't have Windows myself and maintaining a sizable C
utility in both *nix and Windows is tricky.

~~~
Jare
I know, sorry I was so terse, I didn't mean to sound rude. Even my little
thing has given me a few headaches in OSX or in Windows' Linux Subsystem
(where I think it still does not work, no SIGIO/O_ASYNC), so I feel your pain.

~~~
apjana
No problem! You can use nnn in the Linux subsystem on Win 10. Some of the
users reported it works well.

------
eerikkivistik
Going to give it a try now, been missing something like this on OS X. Any good
alternatives I should try as well?

~~~
mherrmann
For a graphical alternative, you might be interested in (my)
[https://fman.io](https://fman.io)

~~~
eerikkivistik
I remember Total Commander from Windows back in the day, similar feature set
to that?

~~~
mherrmann
Yup

~~~
edanm
Awesome work! Total Commander is the one software that I've never found a good
Mac replacement for, and it causes me no end of sadness.

Your approach looks _very_ promising, if still early days. Emailing you
further specific feedback, hope you keep working on this and continue on your
current path.

~~~
apjana
Thank you!

------
orf
Nice! I gave it a go on MacOS, but managed to segfault it when pressing 'D' on
a directory. Can't reproduce :(

Also after quitting 'ls' output is pretty messed up. Seems good overall
though.

~~~
apjana
> managed to segfault it when pressing 'D' on a directory

Very much possible. Though we have tested as much as possible, we are a small
team and the latest iteration has undergone substantial changes. I couldn't
reproduce it so far. But please raise an issue if you have some details.
Something special about the dir name maybe?

> quitting 'ls' output is pretty messed up

nnn does not write to the stderr/stdout once it is in curses mode. Can you
share some more details on the steps?

It would be great if you can raise defects on GitHub. nnn is under active
development.

~~~
orf
> It would be great if you can raise defects on GitHub. nnn is under active
> development.

Sure, will do!

~~~
apjana
Many thanks for the reports you submitted!

------
fareesh
Looks great. It looks like just what I have always wanted on Ubuntu. Giving it
a try!

~~~
apjana
Thanks for the compliment! Merry Christmas!

------
hendry
Prefer ncdu where you can delete stuff.

~~~
floatboth
ncdu is not a general purpose file browser, it's specifically for deleting
large stuff

~~~
apjana
If we are speaking of ncdu
([https://dev.yorhel.nl/ncdu](https://dev.yorhel.nl/ncdu)) nnn has a much
faster disk usage analyzer mode. And it's dynamic while ncdu is static (by
default at least). nnn has a path copier which can copy the file names you
would like to delete to clipboard. You can a shell in the same directory using
`!` and delete the files.

------
alvil
It looks like it is bash dependent

~~~
jdowner
Why do you believe that? It has a section on shell completion for different
shells so I don't think that is the intention,

[https://github.com/jarun/nnn#shell-
completion](https://github.com/jarun/nnn#shell-completion)

~~~
alvil
[https://github.com/jarun/nnn/blob/master/nlay](https://github.com/jarun/nnn/blob/master/nlay)

    
    
      # bash 4.0 way to switch to lowercase
      ext="${ext,,}"

~~~
apjana
Ahh OK! nlay is not an essential part of nnn anymore. It's only invoked if you
use the locker or invoke desktop search utility. We retained those two to keep
the utilities customizable. Are you using any of these two?

Also, `nlay` is editable and you can customize it anytime.

------
Numberwang
The documentation is very poor. Avoid.

~~~
apjana
We have up-to-date comprehensive README and man page with examples.

If that's not sufficient, please help us make it better. What's missing?

~~~
Numberwang
There is NO intro or general overview in the wiki for exemple. Id love to know
what this is befors I try and install it.

~~~
apjana
You might just have missed this -
[https://github.com/jarun/nnn#nnn](https://github.com/jarun/nnn#nnn)

------
rshm
For a moment i was expecting Neural Network (NN) from the title. Along the
line that NN was used to pre-load directory structures, NN in search results
ordering etc.

