[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] questions about uniquely numbered backups
From: |
Eitan Adler |
Subject: |
Re: [Nano-devel] questions about uniquely numbered backups |
Date: |
Tue, 28 Apr 2015 18:40:11 -0700 |
On 28 April 2015 at 04:44, Benno Schulenberg <address@hidden> wrote:
>
> Hi all,
>
> When nano is used with the options --backup and --backupdir set,
> it will make a uniquely named and numbered backup of the file
> currently being edited whenever this file is saved. It will
> store this backup file in the specified directory.
>
> For example, when running 'nano --backup --backupdir=~/STORE NEWS'
> in the directory ~/Repositories/NANO, and then typing ^O <Enter>,
> nano will store the file '!home!ben!Repositories!NANO!NEWS~' in
> /home/ben/STORE. Upon a second save it will store
> '!home!ben!Repositories!NANO!NEWS~.1'. And then .2, and then
> .3, and so on.
>
> Now, when this number reaches the ten thousands, things start
> to slow down, because for every save, nano iterates through all
> the earlier numbers, checking whether the file already exists.
> All these stats take time. On my system, simulating the existence
> of a million earlier backup files, it takes nano some ten seconds
> (it varies from 9 to 12) to find the next free filename. And nano
> will happily go to four billion backup files (on my system, where
> ULONG_MAX is 4294967295), at which point it would take some
> *twelve hours* to find a free file name and save the file.
> Totally absurd.
If nano dosn't do this already, it should start sharding files into
multiple directories inside the backup store. Having millions of
files in a single directory will result in slowness regardless of the
algorithm used to generate filenames.
--
Eitan Adler