-
Simon Proven authored
Found a major inefficiency in the handling of file creation, closing of files and other uses of the NextFree function. In the case of file creation, the problem was particularly bad on large free space maps, as the function was of order N^2 on the size of the map, when the disc was nearly full. As the disc gets fuller, the problem gets worse; with 1400 zones in the map, N^2 is very large indeed. This resulted in *cdir sometimes taking 1sec. Now, a new function NextFree_Quick exists which performs similarly to NextFree, but does not consider free spaces in zones beyond the current zone. This can be used by functions which need only examine free spaces in a given zone, such as is the case in ClaimFreeSpace where it is stepping throigh zones to find a single gap large enough for the entire file. For other functions which work on a single zone, the speedup is less dramatic, of the order N instead of N^2.
3744db9f