First of all, I did RTFM and found nothing suitable. Ma data is XML. I have started with a standard - XSLT and found it terribly slow. I have found that anything that is DOM-based or string-parsing based is too slow for my needs.

So I have used XML::Grove to represent and built my XML trees in the application. Simple, fast and clean way to do it. As no suitable XML templating system was available for XML::Grove, I have written a very simple but powerfull templating system with embeded perl commands. very fast indeed, because crawling XML::Grove tree is fast operation, no text parsing, no extensive searches, no overkill-DOM interface overhead.
I pre-parse all the templates on apache start-up and keep that in memory. Embeded-perl templates are stored as coderefs, indeed.

At a 10000feet my application looks like:

  +-------------+ XML  +----------------+ HTML/WML/whatever
  | Application |----->| tmpl processor |----->
  +-------------+      +----------------+
                               ^
                               |
                           templates
Note that I represent XML trees as perl hashes, not a strings, so any IPC between application and templating modules will make the whole system ineffective.

But if there is no module to share that data (as you indicated) could anyone provide me with any idea how to share a coderef between two processes? I thought that P-code is the same, no matter in what perl interpreter it runs in. I need this only for processes with the same (or very similar) symbol tables - processes forked from the same parent (typical Apache/mod_perl processes).


In reply to Re: Re: Fast shared data structures by gildir
in thread Fast shared data structures by gildir

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.