This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Sparse file performance


Rolf Campbell wrote:

> I created a 3Meg, 6Meg, 10Meg and 40Meg file using cp /dev/zero. 
> I then copied each file using windows explorer (and then verified 
> that the sparse bit was gone).
>
> Then I ran 'time cat filename > /dev/null' (i ran it a few times 
> to make sure the file was cached). The performance difference was:
>
> 40Meg: 5%
> 10Meg: 7%
> 6Meg: 10%
> 3Meg:  5%
>
> This wasn't the most sofisticated test ever, I did not ensure that 
> the files were equally fragmented on disk. But, it does show that
> sparse files are notably slower.

Rolf,

to remove the possible biases you allude to, could you start from
an existing file, time it, then change it (in place) to a sparse
file and re-execute the timing test?

The way to change the file to sparse follows (untested, I don't have 
access to sparse files today)

DWORD dw;
HANDLE handle = CreateFile(name, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 
	                   FILE_ATTRIBUTE_NORMAL, NULL);
(returns INVALID_HANDLE_VALUE on error)
BOOL r = DeviceIoControl ( handle , FSCTL_SET_SPARSE,
			  NULL, 0, NULL, 0, &dw, NULL); 
(returns 0 on error)


Pierre

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]