0

アプリケーションを最初に起動するたびに、必要なすべての参照データ(1MBのサイズのテキストファイル(csv形式))をダウンロードします。このデータには約30000行が含まれ、各行は名前、緯度、経度、高さのデータエントリです。

このデータを保存するための最もパフォーマンスの高い方法は何ですか?これらのリストをIsolatedStorageSettingsに保存しようとしました。しかし、これは絶対に最悪のアプローチです。

もう1つの方法は、テキストファイルをIsolatedStorageFileディレクトリに保存し、アプリケーションを起動するたびにファイルをロードして、リストに解析することです。

最もパフォーマンスの悪い部分は、ファイルの読み取りです。だから、sqliteのようなデータベースを使用することにも同じ問題があると思いますね。

この問題をどのように扱いますか?

よろしく、ダニー

4

1 に答える 1

1

I did something similar in WherOnEarth application. We have a SQLCE database that we store the data in and then load the stuff that is near by.

Background reading: http://www.silverlightshow.net/items/Windows-Phone-7.1-Local-SQL-Database.aspx & http://www.jeffblankenburg.com/2011/11/30/31-days-of-mango-day-30-local-database/

I have a sdf file that I ship with the app, a Data class shown below

    [Table]
    public class PointData : IPositionElement, INotifyPropertyChanged
    {
            [Column]
            public string Description { get; set; }

            [Column]
            public double Latitude { get; set; }

            [Column]
            public double Longitude { get; set; }

Then we I read the points that are near by I get them with the following:

    (from ht in _context.Points
         where ht.Latitude >= bottomLeft.Latitude && ht.Latitude <= topRight.Latitude &&
         ht.Longitude >= bottomLeft.Longitude && ht.Longitude <= topRight.Longitude
         select ht
         ).ToArray();

This approach was fast enough for me (i.e. it took less time to get the items out of the sdf file than it did to position them on the screen an ddo all the other associated maths with that. Admitedly I wasnt trying to get 300000 items from the DB. There were more optimizations that I could have done in relation to indexing and things like that, but as I said it was quick enough at the moment so I will revisit it at some point later.

于 2012-02-17T12:35:19.153 に答える