Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^4: Comparing HTML::Template::Compiled's compatibility to HTML::Template

by perrin (Chancellor)
on Dec 30, 2005 at 16:35 UTC ( [id://520017]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Comparing HTML::Template::Compiled's compatibility to HTML::Template
in thread Comparing HTML::Template::Compiled's compatibility to HTML::Template

TT doesn't do anything with shared memory. It keeps the compiled templates in the local process, and shares their perl format on disk. I thought HTC did the same thing. Accessing shared memory from perl is usually pretty slow because of the need to serialize everything, so this type of setup ends up being faster for most cases. It wouldn't surprise me if TT used more memory than HTC, but I expect they aren't that far apart. A memory benchmark would certainly be interesting, but it's very hard to get accurate numbers that account for things like copy-on-write sharing.

Anyway, recreating the TT object on every request is a common mistake by new TT users. It has even more of an effect when people use many includes.

  • Comment on Re^4: Comparing HTML::Template::Compiled's compatibility to HTML::Template

Replies are listed 'Best First'.
Re^5: Comparing HTML::Template::Compiled's compatibility to HTML::Template
by tinita (Parson) on Dec 30, 2005 at 17:17 UTC
    TT doesn't do anything with shared memory.
    I meant the copy-on-write issue. HTC keeps the compiled objects in memory, but it doesn't write on the data structure, so that it stays shared between processes when it was preloaded before forking.
    I don't know how TT handles this; is there a preload mechanism?
    It wouldn't surprise me if TT used more memory than HTC, but I expect they aren't that far apart.
    Seems like HTC uses 75-80% of the memory of TT. Which is what you would expect, probably.
    A memory benchmark would certainly be interesting, but it's very hard to get accurate numbers that account for things like copy-on-write sharing.
    I worked on my memory benchmark a bit: bench_mem.pl
    If I didn't make a mistake, it shows that the objects stay shared for both modules (root process doesn't change its size).
    update: I think the script is still not working correctly...
    Anyway, recreating the TT object on every request is a common mistake by new TT users.
    right. it's probably because it's different from HTML::Template, for example, where an object represents a template.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://520017]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-04-19 04:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found