Re: Threaded DOM operations
Re: Threaded DOM operations
- Subject: Re: Threaded DOM operations
- From: Matej Bukovinski <email@hidden>
- Date: Tue, 22 Jun 2010 12:31:31 +0200
A single DOM operation may not be slow, but a bunch of them together can be. The problem is that sometimes I have to do a lot of DOM operations for several pages (walking the DOM three, flagging some DOMNodes, removing and shifting nodes around). I'm currently using grand central dispatch to offload as much as I can to background threads and doing DOM operations in between on the main tread. It would be nice to have the main tread free of such computation in order to have a responsive UI.
I was afraid that NSXMLDocument would not handle HTML as good as WebKit does. It might be worth another look though. Thanks for the suggestion.
On 21.6.2010, at 21:00, Jens Alfke wrote:
>
> On Jun 21, 2010, at 3:50 AM, Matej Bukovinski wrote:
>
>> I'm using WebKit to download a bunch of websites. On those sites I need to perform some basic DOM tree operations (e.g., removing some DOM nodes). WebKit makes this very straightforward by using elements such as DOMNodes to represent the document three. The problem is that those operations can be time intensive
>
> That sounds weird to me. Those operations should be very fast. What is it you’re doing? Have you made sure you’re not using any techniques that scale poorly (such as bubble-sorts)? Are you sure it’s CPU-bound, or is it the time to load the web page that dominates? (If that’s the problem, you can definitely make WebKit load multiple pages in parallel.
>
>> Does anyone have a suggestion how one would modify a HTML DOM on a background thread?
>
> Not with WebKit.
>
>> Perhaps some other framework that would allow me to construct a DOM tree from HTML source code and have basic tree operation support?
>
> You could try using NSXMLDocument. If you use the tidy flag, it can parse real-world HTML. You might be able to use different instances on multiple threads.
>
> —Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden