Is storing 400,000 data in Core Data for metro route finder?

I am trying to make a metro application that finds the shortest path from station to station.

I tried Dijkstra's algorithm with multiple heap patterns to actually calculate the best route each time the user selects a start station and an end station.

But I'm wondering if it would be better to store all possible routes in Core Data, so the app doesn't have to calculate the best route every time, but rather pulls the best route information from Core Data p>

There are 624 stations. and 624 X 624 = 389,376 existing tracks from any station to any station.

Some of the information for EVERY possible route will contain something like:

- starting station : String
- end station : String
- stations in-between : String 
- total time it takes in seconds : Double
- number of transfers : Int
etc. 

      

My main question is: Assuming I already have 389,376 data, would it take too much disk space if I saved all 400.00 of some data in Core Data? or it will just be a trivial problem.

I try to avoid using Dijkstra because it takes quite a long time to account for transmission time, transmission preference, etc.

+3


source to share


2 answers


If you really want to store all this data, I recommend that you use SQLite instead of CoreData in order to properly manage the size of the data. there is a nice wrapper for this purpose https://github.com/ccgus/fmdb

You can estimate the size of your database as



- starting station : String (average size about 20 bytes - one byte per char)
- end station : String (average size about 20 bytes)
- stations in-between : String  (average size about 20 bytes)
- total time it takes in seconds : Double (8 bytes)
- number of transfers : Int (4 bytes) 

      

total: 72 bytes per line * 400,000 = 27.4 MB

0


source


Not necessary. I have multiple apps ranging from 1GB to 11GB in size on disk. It would seem that your usage will be less than 1 GB.

For reference, check your iPhone Settings -> General -> Manage Storage to get an idea of ​​using another app.



Please note that many users may only have 16G iPhones.

0


source







All Articles