[vwnc] Threaded XML-unmarshalling?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] Threaded XML-unmarshalling?

Steffen Märcker
Hello,

I wonder whether it is possible to run a time-expensive xml-unmarshalling  
task in a concurrent vw thread in order to keep the UI responsive. I am  
thinking of something like:
p := [|doc|
        doc := (XMLParser new)
                on: xmlfile;
                scanDocument.
        manager unmarshall: doc] promise
However, since neither the XMLParser nor the XMLObjectMarshalingManager  
seems to yield the process they're running in, it does not work. Is there  
a way I am not aware of or some "safe code modification" to get the  
desired result?

Regards, Steffen
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Threaded XML-unmarshalling?

Holger Guhl
Hi Steffen,
could it be an option to use the #promiseAt: method instead of #promise
? If the XML unmarshaling process runs at priority less than the UI
process you have the desired effect...

Cheers,
Holger

Steffen Märcker schrieb:

> Hello,
>
> I wonder whether it is possible to run a time-expensive xml-unmarshalling  
> task in a concurrent vw thread in order to keep the UI responsive. I am  
> thinking of something like:
> p := [|doc|
> doc := (XMLParser new)
> on: xmlfile;
> scanDocument.
> manager unmarshall: doc] promise
> However, since neither the XMLParser nor the XMLObjectMarshalingManager  
> seems to yield the process they're running in, it does not work. Is there  
> a way I am not aware of or some "safe code modification" to get the  
> desired result?
>
> Regards, Steffen
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>  
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Threaded XML-unmarshalling?

Holger Guhl
Steffen,
I have just tried this:
    [CAST.XMLObjectReader importUAXFileset] promiseAt: Processor
userBackgroundPriority

It's code from of my recent projects, implemented wit VisualWorks 7.6.
The job is still running while I am writing this and tries to parse
files with XML data (total of about 25 MB, 73.000 objects, significantly
more XML nodes) and convert (unmarshal) them into Smalltalk objects of
the project domain. The entire VisualWorks image with all tools remains
highly responsive, I can use menus to open Browsers which pop up
immediately without flicker or noticeable delay, and believe me my
computer is a quite aged and slow. Opening the ProcessMonitor I can
watch the busy process working hard.
Now it has finished and the promise has the result.
Since user processes (GUIs) are supposed to run at
#userSchedulingPriority it should work for the general scenario you are
describing. It's worth giving it a try.

Cheers

Holger Guhl
--
Senior Consultant * Certified Scrum Master * [hidden email]
Tel: +49 231 9 75 99 21 * Fax: +49 231 9 75 99 20
Georg Heeg eK Dortmund
Handelsregister: Amtsgericht Dortmund  A 12812


Steffen Märcker schrieb:

> Hi Holger,
>
> I am not sure to 100%, but I think it won't work. Once the
> unmarshalling process runs, it never lets yields the processer to
> other threads, thus the effect would be the same as computing the
> value directly when it's needed. But I inteded to unmarshall in
> background, while the user takes other actions, to save time.
> Please correct me, if I am wrong!
>
> Cheers,
> Steffen
>
> Am 14.07.2009, 13:21 Uhr, schrieb Holger Guhl <[hidden email]>:
>
>> Hi Steffen,
>> could it be an option to use the #promiseAt: method instead of
>> #promise ? If the XML unmarshaling process runs at priority less than
>> the UI process you have the desired effect...
>>
>> Cheers,
>> Holger
>>
>> Steffen Märcker schrieb:
>>> Hello,
>>>
>>> I wonder whether it is possible to run a time-expensive
>>> xml-unmarshalling  task in a concurrent vw thread in order to keep
>>> the UI responsive. I am  thinking of something like:
>>> p := [|doc|
>>>     doc := (XMLParser new)
>>>         on: xmlfile;
>>>         scanDocument.
>>>     manager unmarshall: doc] promise
>>> However, since neither the XMLParser nor the
>>> XMLObjectMarshalingManager  seems to yield the process they're
>>> running in, it does not work. Is there  a way I am not aware of or
>>> some "safe code modification" to get the  desired result?
>>>
>>> Regards, Steffen
>>> _______________________________________________
>>> vwnc mailing list
>>> [hidden email]
>>> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Threaded XML-unmarshalling?

Steffen Märcker
Hi Holger,

I've had a process issue in my code, thus the xml unmarshalling did not  
run. Thanks for your tip, I wouldn't have found that one. Now anything  
works as expected.

Thanks!
Steffen


Am 14.07.2009, 20:23 Uhr, schrieb Holger Guhl <[hidden email]>:

> Steffen,
> I have just tried this:
>     [CAST.XMLObjectReader importUAXFileset] promiseAt: Processor  
> userBackgroundPriority
>
> It's code from of my recent projects, implemented wit VisualWorks 7.6.
> The job is still running while I am writing this and tries to parse  
> files with XML data (total of about 25 MB, 73.000 objects, significantly  
> more XML nodes) and convert (unmarshal) them into Smalltalk objects of  
> the project domain. The entire VisualWorks image with all tools remains  
> highly responsive, I can use menus to open Browsers which pop up  
> immediately without flicker or noticeable delay, and believe me my  
> computer is a quite aged and slow. Opening the ProcessMonitor I can  
> watch the busy process working hard.
> Now it has finished and the promise has the result.
> Since user processes (GUIs) are supposed to run at  
> #userSchedulingPriority it should work for the general scenario you are  
> describing. It's worth giving it a try.
>
> Cheers
>
> Holger Guhl


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc