in reply to Re: fast return of HTML::Tree object clones (via threads/forks)?
in thread fast return of HTML::Tree object clones (via threads/forks)?

Why are you modifying the tree? That sounds rather suspect to me.
If you weren't modifying the tree, then you would be better of simply serving it via Apache without loading it into memory and or HTML::Tree to begin with :).

So anyway, I was keeping my discussion tongue-in-cheek because I did not want to open another can of worms, but the real scenario is that HTML::Seamstress is a set of convenience functions for dynamic HTML generation via HTML::Tree and currently I use new_from_file but was thinking I could get a speedup by pre-parsing and cloning. But you are right, I probably should do some benchmarking on the two approaches before getting into a hissy.

But wait - there is a very good reason to pre-parse anyway. You can parse the HTML and then throw it away. The way things are setup where I work, our apache server talks to our HTML aggregation server via tcp/ip. The apache server serves static things like images, css, etc. But for HTML aggregation of search results, it forwards the request to the aggregation server, which makes a bunch of search requests and returns dynamically generated HTML... when we get a package of HTML and gifs and css from the design department, the first thing I have to do is copy the HTML file to the aggregation server and then make a .pm of it so that I can dynamically rewrite it at runtime. The gifs and css stay on the apache server. So, I could save myself something of a step if I could parse the HTML once, serialize it, and then clone it at runtime as necessary.