I have, for a long time now, been writing a perl program (gasp!:).

It is called The Manifold Engine, and it does many things, and will someday do *everything* for my web site. Mainly, it parses and 'compiles' my pages. (Manifold: having many forms or features) It gives no error messages now, with -W and use strict, and is nice to work with. some of things it does are: SSI's, custom tags like <@TAG@> could equal "The chickens, they scare the children", and I have 'Commands', like <$randomquote$=1$> that returns a random quote. See, it is the entire site, like index.pl, I guess. page=pagename, or form=login, etc.

What I want to know is, is there anyway to make such a insanely large thing (400 lines, I think) run faster? I've not had to put any load on it, only me testing it, and it takes only 2 secs longer than a static html page of exact same size.

I *have* tried to do this myself, by the way. it has many 'modes' (colors), and instead of "if mode is this, do this, elsif this, do that" etc, I did this:

if (defined($params{modes}->{$mode})) { $params{modes}->{$mode}->(); }
Also, I am going to use MySQL instead of plain text files, for larger amounts of data (news boards, downloads, fun things), and my server will be using mod_perl, soon. I've used most of the ideas (all?) from the Camel partaining to speed. Also, I would like to know if this All In One Perl CGI, is a bad idea.. Is it the work of a mad man?

I can post a link, if someone wants to view it.
Sorry if this post was long.
If anything is unclear, sorry.
I thank you for taking the time to help crazy perl. :) P.S. Oh yeah, loading it from localhost, it takes 1/2 second to load... maybe it is fast, but the server it will be running on is not a 512mb system with a 1ghz processor, like my home system.

In reply to Speed, and my sanity. by Dylan

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.