1) Some folks have complained about object [de]serialization, so if
Gears is present, why not move this task off to a worker. RPC is
already asynchronous, just get this stuff out of the main ui loop.
2) LocalDB backed SuggestBox. Why not have suggestions cached by a
worker, then when a Suggest box is used the suggestions could be
served from the local data store.
3) Cache i18n Strings in the local database ... this could allow
users to change regions on the fly, and pretty much instantaneously.
4) From the Gears list, someone has already made a dictionary, so how
about a Gears backed spelling api for the RichTextEditor.
Any other ideas?
-jason
http://groups.google.com/group/google-gears/browse_thread/thread/e6e857a522c21408
I haven't looked at the implementation at all, but the code samples
seem pretty nice. A generator-based implementation could do away with
even the minimal amount of boilerplate that the code has now, and
could start adding things like ID field support, one-to-many / many-to-
many references, etc., etc.
Cheers!
Rob
> Moving deserialization onto a worker thread would be pretty cool.
> Although, since threads only communicate using strings today, how
> would you get the deserialized object back? Some other form of
> communication?
Hadn't looked that closely at it yet. But that sorta leaves us in the
same boat doesn't it. deserializing to a database would work, but I
was hoping it could be a little more automatic than that. I wonder if
the worker comunication via strings is an artificial limitation, and
could allow passing of arbitrary objects in the future?
-jason
My unreliable understanding is that JavaScript only communicates with
plugins via Strings/numbers for both portability, security, and
simplicity reasons. Otherwise plugins would need a non-trivial
understanding of JavaScript engines and their memory management
methods.
--
Sandy McArthur
"He who dares not offend cannot be honest."
- Thomas Paine
Moving deserialization onto a worker thread would be pretty cool. Although, since threads only communicate using strings today, how would you get the deserialized object back? Some other form of communication?
I guess that you could always deserialize into a database...
On 6/5/07, Jason Essington <jason.e...@gmail.com> wrote:
> I wonder if
> the worker comunication via strings is an artificial limitation, and
> could allow passing of arbitrary objects in the future?
My unreliable understanding is that JavaScript only communicates with
plugins via Strings/numbers for both portability, security, and
simplicity reasons. Otherwise plugins would need a non-trivial
understanding of JavaScript engines and their memory management
methods.
Actually, there's a very strong architectural reason why worker
threads only communicate by strings. It's to avoid sharing a heap.
If worker threads shared a heap and could directly pass objects back
and forth, then suddenly you'd be faced with supporting full threading
and synchronization in Javascript, because now the worker thread would
be mutating the same Javascript heap objects as the main heap.
Whammo, synchronization rears its horribly ugly head. That's not
something the Gears team is ever likely to tackle, because the win is
just not worth the cost.
... Hmm. Actually, now that I think about it a bit more, there
*could* be a creative solution to this. It would have to involve
sharing a single heap, but *not sharing any heap objects.* The main
thread -> worker thread interface would have to religiously copy every
single Javascript object graph sent back and forth, to prevent any
sharing of any kind whatsoever.
Doing this could be something like implementing the Singularity
research operating system's model of "software isolated processes":
http://research.microsoft.com/os/singularity/publications/mspc2006_deconstructingisolation.pdf
Read that paper if you want to understand the design space here a lot
more.
The main benefit would be much higher potential bandwidth
communication between Gears threads, with much, much more room for
native optimization of the inter-thread object copying. However, it
would also be no small amount of work! So don't expect it anytime
soon....
Cheers!
Rob
... Hmm. Actually, now that I think about it a bit more, there
*could* be a creative solution to this. It would have to involve
sharing a single heap, but *not sharing any heap objects.* The main
thread -> worker thread interface would have to religiously copy every
single Javascript object graph sent back and forth, to prevent any
sharing of any kind whatsoever.
It seems that eval() plus a 1:1 mapping of JSON export of a GWT class could do the trick.
On 6/6/07, Miguel Méndez <mme...@google.com> wrote:It seems that eval() plus a 1:1 mapping of JSON export of a GWT class could do the trick.
But is that actually saving any work? It seems like that is essentially the same thing as the RPC deserialization that we wanted to move into the worker thread in the first place.
I don't know. That sounds like a good argument to me for improving the wire format in general, across all cases, as opposed to only for Gears. I really don't want to see us throw in Gears' specific optimizations that should really apply to all users.
I'll have to think about that, but it is a different direction than I was headed. Here is some sample code.
[From the EntryPoint]
try {
GearsDataStore ds = (GearsDataStore) GWT.create(MyData.class );
ds.createTable();
ds.save(new MyData());
MyData[] data = (MyData[]) ds.loadAll();
...
ds.deleteTable();
ds.close();
}
catch (DatabaseException e) {
e.printStackTrace();
}
The data store is generated from the MyData bean. The bean contains annotations that describes the table, and eventually could also describe relationships between this bean and other beans.
[MyData.java]
/**
* @gears.table ( name = MyDataTable )
*/
public class MyData implements GearsDataObject
{
/**
* @ gears.id (length=100)
Sure. You can totally crawl the type tree and look at the metadata of any types. RPC has to do exactly that for handling @ gwt.typeArgs annotations.
Cheers!
Rob
(HQL generated to SQL on the server *would* be cool, though, huh?)
Cheers!
Rob
Cheers!
Rob
As GWT apps will become larger as the time goes by,
we'll surely see some apps that will become too large to fit into one
decently sized javascript files.
Especially Enterprise applications will need a lot of libraries.
GWT could in the future (GWT release 8.275 RC1 ;-) ) have some kind of
lazy- or eager classloading mechanism, where the compiled JS code for
the libraries could be cached in Gears.
Just a mindspin...
Greetz,
Menno van Gangelen.