aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2017-12-17 23:08:55 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2017-12-17 23:08:55 +0530
commit7a16440e1f1e6002d8a38e2b1ade9437dc3c79de (patch)
treeccbbd6fcd7597ace6e0bc6edaadd395df431137e /Makefile
parent683fa655781e03eb8bcba9c5c0d5d0414e0933a2 (diff)
downloadnnn-7a16440e1f1e6002d8a38e2b1ade9437dc3c79de.tar.gz
An even faster nnn - no more copying file names!
nnn has been using `struct entry` to hold both file name as well as file info. The design forces file names to be copied in the following cases: - swaps during file sort (nnn uses quicksort) applied after all the matching files are read (in no particular order; good old readdir()) into memory. - swaps during manual filtering. nnn moves non-matching entries below so they are not encountered twice resulting in fast filtering. There were scopes for _massive_ improvements in this area. So I did what had to be done - decouple the file names from `struct entry` and use a separate struct to hold the names with the indices set when the files are added by opendir(). There was a hidden problem to this approach - nnn uses realloc() to allocate memory for file information and realloc() may move the original pointer in mem when it can't fit the new memory to the earlier pointer. To handle that the new algorithm tracks the change in memory location and re-adjusts the existing dir entry names when that happens; this too, without any copying! Though the results seem pretty clean from a theoretical point of view and early tests, we may uncover some bugs. However, the speed is just mind-blowing! And the binary size remains the same too!!!
Diffstat (limited to 'Makefile')
0 files changed, 0 insertions, 0 deletions