when adding 10’000 objects the code runs though, but when adding 20’000 we receive error:

rangeerror: maximum call stack size exceeded

this means that there are to many java script stack calls so the java script fails.

we use your task entity as described in the example:

var Task = persistence.define(‘Task’, {
name: “TEXT”,
description: “TEXT”,
done: “BOOL”
});

for ( var i = 0; i < 20’000; i++) {
var t = new Task();
t.name = ’Task ’ + i;
t.done = i % 2 == 0;
persistence.add(t);

if(i%500==0){
persistence.flush();
}
}

we are working on a proof of concept to get a huge amount of data to mobile devices and we do need the possibility to loop though 100’000 of objects, at least.

if we do not use persistence.js and use native sql to store objects in database storage it works fine within a few seconds to store 100’000 objets. what is the problem with persistence.js? this looks like a bug…

thanks

Submitted on 29 September 2010 at 17:15

On 29 September 2010 at 20:51 Zef Hemel commented:

Hi Remo, thanks for reporting. In fact, I had an optimization for this before, but accidentally disabled it. Flushing a large number of objects should now work. Performing asynchronous sequential operations on large arrays is heavy on the stack. In the particular case of flushing I was able to solve this issue, but in general I cannot. persistence.js is not really optimized for large batch operations like what you’re doing, but see if it works better for you now. Let me know.


On 30 September 2010 at 13:39 Lipp Christoph commented:

Hi Zef

We tried your new version and it works great now (at least on safari, Chrome does not work, because of a 5MB database restriction… :| even tough we requested 100MB in the open function).
Anyway, we’re really happy with the result of your latest changes and tried the page on a mobile phone (Android, WebOS, Safari) and it doesn’t work on mobile safari, or android or whatever.

The javascript error is:
Javascript Error on Line 67
persistence.store.websql.js TypeError: Result of expression ‘that.conn’ [undefined] is not an object.

If you’re working on a mac you can test it with the iPhone simulator, enable the developer mode in safari in the settings. Otherwise download the WebOS simulator or android simulator they both should have something like a debug mode even though I have no clue where to enable it :)

any plans to support mobile browser? we have to build the application for mobile devices so it’s essential for us :)


On 30 September 2010 at 14:58 Zef Hemel commented:

Hi Lipp, the whole point of persistence.js was to use it on mobile phones :-) I’m using it here, works fine for me. Just tested it in the iPhone emulator, no problems connecting. The error you report suggests that the openDatabase(dbname, '1.0', description, size) call failed somehow. Did you maybe provide an invalid description, name or size (too large?).


On 30 September 2010 at 15:00 Zef Hemel commented:

For instance, can you run the persistence.js unit test suite on the iPhone emulator (it’s in test/test.persistence.html). That one runs fine for me, cannot test it on an actual device right now.


On 30 September 2010 at 15:12 Lipp Christoph commented:

Oh, you’re right, it works when changing the requested size to 50MB (at least on an iPhone it still doesn’t work on android there I have to change it to 5MB…).

Thanks anyway!


On 30 September 2010 at 15:17 Zef Hemel commented:

Ok, good. I’ll close this issue, incidentally, if you have more problems (not necessarily bugs), there’s also a Google Group: http://groups.google.com/group/persistencejs


On 30 September 2010 at 15:17 Zef Hemel closed this issue.

Log in to post comments