Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6793585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:07:05+00:00 2026-05-26T18:07:05+00:00

I have a CSV file that contains over 80,000 rows and 100 columns. I’m

  • 0

I have a CSV file that contains over 80,000 rows and 100 columns. I’m trying to handle loading /accessing the CSV data in the most performance-efficient way possible. Right now my CSVParser loads the data into an NSArray, but it’s extremely slow/sluggish; this is a problem as I hope to handle this parsing/loading on a mobile device: the iPhone.

Any suggestions for an alternate method would be much appreciated. Thank you

UPDATE:

For future reference/discussion, I now have the following attempt:

// Mark time the parser starts 
NSTimeInterval start = [NSDate timeIntervalSinceReferenceDate];
// Parse the CSV file
[parser parse];
NSTimeInterval end = [NSDate timeIntervalSinceReferenceDate];

// Print how long the parsing took 
NSLog(@"raw difference: %f", (end-start));

// Copy the allLines array from the parsing delegate 
NSArray *allOfTheRows = [NSArray arrayWithArray:d.allLines]; 
NSLog( @"There are %i lines in the csv file", [allOfTheRows count]); 

NSFileManager *f = [[NSFileManager alloc] init]; 
NSString *filePath = @"/Users/..../rawData"; // This is of course not a literal location...

// Archive the array as NSData 
NSData *someData = [NSKeyedArchiver archivedDataWithRootObject:allOfTheRows];

// Write the data to a file
[f createFileAtPath:filePath contents:someData attributes:nil]; 

/*
 If I were to load the data from the iPhone, i'd copy the newly created someData file above to my application's mainBundle, and then unarchive the NSData to an array on the iPhone
*/
// Read the data back as an array 
NSData *readData = [NSData dataWithContentsOfFile:filePath]; 

NSArray *bigCollectionReadBack = [NSKeyedUnarchiver unarchiveObjectWithData:readData]; 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:07:06+00:00Added an answer on May 26, 2026 at 6:07 pm

    I had similar problems with CSV parsing on the iPhone. I ended up doing the parsing on the Mac and writing out a binary file containing the array of struct data. It used to take 120 seconds to parse/load the CSV file on the iPhone 4 but the binary file loads in under 10 milliseconds.

    EDIT – To elaborate a bit more, on the Mac I read the CSV file, organize the data into several arrays of structs then write out the data to a binary file using fwrite. On iOS I read the binary file using fread (one read for the header to get size info, and a second read for the data) into an array of structs of the right size. One of the larger files is 2.2MB and it takes 66 msec to read from the flash into RAM using fread.

    2011-11-15 17:32:35.304 -[BinFile initWithFile:] 001953f0 file Metro
    2011-11-15 17:32:35.370 -[BinFile initWithFile:] read 2217385 bytes (Metro)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CSV data file with rows that may have lots of columns
I have an Excel (or CSV) file that contains the following flattened columns: ID,XPath,Required?,BaseType,Restrictions
Hi i have a CSV file that contains rows like this Jacop , Assistant,150,75
I have a .csv file that contains data for only certain columns in a
I have a file that contains the following in a csv file; country,region,city,postalCode,metroCode,areaCode I
I have a Testing project that contains a csv file which a webtest uses
I have a CSV file that holds about 200,000 - 300,000 records. Most of
In short, I have a 20,000,000 line csv file that has different row lengths.
I have a csv file that contains a location field. I need to import
I have a large CSV file that contains independent items that take a fair

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.