views:

22

answers:

0

I have created application for testing Linq queries (time) which I using in game project. And now, one query take 1.2s on Windows Application, but when I'm trying to use that same query on windows game (XNA 4.0) it is really, really, really slow and i don't know why.

I cannot use SQLite database ( windows game is only for testing purposes, final game is for windows phone 7 )

//EDIT: as a query i mean Xml.Linq I have sth about 10tables (~20MB), example query iterate over 4 tables (I divided it to 2 queries) and it takes 1.2s on application.

to represent Cell i create struct

public struct Cell
{
    public char[] value;
    public Cell(char[] v) { value = v; }
}

    var r = from fp in XMLFiles.name_of_table_position.Descendants("ROW")
            where fp.Attribute("field").Value.Equals(arguments[0])
            select new Cell[]
            {
                    new Cell(fp.Attribute("field").Value.ToCharArray()), 
                    new Cell(fp.Attribute("field").Value.ToCharArray()), 
                    new Cell(fp.Attribute("field").Value.ToCharArray())
            };

and copy to rows table

    int count = r.Count();
    rows = new Cell[count][];
    for (int i = 0; i < count; i++)
    {
        rows[i] = r.ElementAt(i).ToArray();
    }

I know it looks terible, but I have to use database interface created for SQLite and it needed

//Edit2: the largest table (XML) has 5000+ lines