Memory and speed issues relating to reading large files in iphone

I want to read a file that contains atleast 60k words. Now I want to search if the word that is stored in a variable exist in this file or not.

Ignore the coding, I want to know the memory issues related to this problem. If I store all these words in the array and then compare them. The speed issue that will effect the iphone. If anyone has better way to do it without using memory and cpu. Kindly give me details.

Best Regards

Answers


If all you have is a list of words, the fastest you will probably get is to sort the file, then mmap it. You can do a binary search on the mapped memory which would be pretty quick.

The nice thing is that you can mmap it read-only, and it will not result in any dirty memory pages, which is really what you have to worry about when talking about memory usage on an iOS device.


Need Your Help

How to write data to Socket opened by Flex from Java Server

java actionscript-3 sockets flex3

Ok, basically my Flex app will open up a socket and listen on it. My java program will write some string to this port.

Is it possible to use CORS or JSONP to access the OpenID Provider Configuration?

javascript cors pingfederate

I'm attempting to use a XHR/Ajax call to our PingFederate configuration (/.well-known/openid-configuration) but I'm getting a cross-domain error.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.