About the performances issues, I just benchmark a call to [Something
allObjects] with 150 rows in the table, on my devices it takes 3
secondes to load ! :( Is that the kind of performances expected (it's
far faster to load from a local plist...) or did I do something wrong?
A previous call to sqlite3 *database = [[SQLiteInstanceManager
sharedManager] database]; is pretty fast, so it's really the SELECT
itself (I think it's the part of SQLitePersistentObject.m that fetch
columns and put it in the properties).
Any hints ?
My Something is really simple :
@interface Something : SQLitePersistentObject {
NSString *name;
int zipcode;
NSString *name2;
NSString *name3;
NSString *name4;
NSString *name5;
NSString *name6;
NSString *name7;
float something1;
float something2;
int something3;
}
As the datas are really simple (simple tables) I have the feeling the
issue is not about loading 150 rows (the AdressBook has much more and
loads fast) but more about the code itself that loads the rows.
I'll digg into this, I would not be surprised if using something like
fmdb and manual calls would make a similar allObjects methods much
much faster.
Guys,
I used FMDB to develop my own allObjects method to compare, on my
iPhone it takes 0.20 sec instead of >3secondes to load
150 rows. which is far more what I expect from such a device.
I guess I would recommand NOT using sqlpo if you store more than 10
rows in your table (or I missed something). I would have appreciated
to use a higher library for such a need, but the current performance
of sqlpo is really too slow.
I would recommand removing thoses for() loops which runs for every
column for every rows in SQLitePersistentObject.m, they feel like
performance killers.
Cheers.
That said though, instead of just bailing on SQLPO, what can we do to
improve it and get some sort of parity?
Who knows, Apple may add CoreData to iPhone OS 3.0 but if they don't
or if you want to support 2.x, having a nice persistence framework is
important and a real help.
Ah I'm not alone then. Maybe it should be in the README so people like
me don't spend hours trying to have something working, when it's
actually not working anyway.
> That said though, instead of just bailing on SQLPO, what can we do to
> improve it and get some sort of parity?
Sadly looking at the code I have the file I specified should be
rewritten. But the whole project is not so much line of code, I don't
get why nobody has written something like this.
Anyone tried the one from OmniGroup ? (I just checkout their source
but did not try it yet)
I came here as a user and not as a potential contributor (I know it
sounds like assh*le talk).
I'll just implement my own lib for my own use later if I need to, and
release it if it helps anyone.
> Who knows, Apple may add CoreData to iPhone OS 3.0 but if they don't
> or if you want to support 2.x, having a nice persistence framework is
> important and a real help.
I agree.
>
> You know, I'm just going to say it. The iPhone isn't a desktop
> machine. Loading 150 rows means creating 150 objects at once. Yes, the
> mechanics may not be perfect yet, but use a little sense here.
My code does create 150 objects at once, still is faster from a
magnitude.
Because it's not a desktop machine, you want the code to be superfast
and optimized.
>
> I absolutely agree. I've made a few attempts at improving performance,
> and after I'm done implementing the new structure I had some designs
> for more effective querying.
>
> The idea I had was to use a proxy object for the results. For large
> collections it would load say 10 at a time. That way any sorting that
> needed to be done could just be done invisibly by re-issuing the query
> to the database.
You should first fix the findByCritera method and make it much faster,
quickly looking at it it
goes through every column for every returned rows, to see column's
type, etc. That should
be done only on the first returned column.
And that method is far too long and too complex to not be buggy and
slow.
I don't see how you're testing your few attemps of improving
performance without performance ... tests. I have not found them
anywhere.
Can I suggest to change the README on github to add a :
** WARNING **
The current state of the code should not be used for real
applications, its slow.
That would definitly save time for the upcoming users.