Re: reading in text files
Re: reading in text files
- Subject: Re: reading in text files
- From: Marcel Weiher <email@hidden>
- Date: Fri, 1 Feb 2002 20:16:29 +0100
On Friday, February 1, 2002, at 12:45 , jgo wrote:
I'll bite. What if the file were 160MB... or 1.6GB?
Memory map ( ...withContentsOfMappedFile) an NSData. Do not use
NSString, do not use NSScanner.
Try to avoid generating your own copies of the individual data items,
reference the orignal memory instead. Try to avoid writing into the
mapped memory, as that will generate a private copy.
I am not sure if the VM subsystem recognizes sequential scanning. If
not, there is madvise() or the equivalent Mach call to advise the kernel
that you are scanning sequentially (allowing it to more easily discard
pages you have just processed, which are otherwise very 'hot' and thus
liable to displace more useful resident pages).
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.