Update: Clarified and fixed typos.

Without more of an idea of what your script actually does, there's little to go on, save the ol' crystal ball method. Based on that, here's one idea out from left field.

AgentM alluded to this, but I thought I'd spell it out a bit more clearly. You might also take a look at the work your script is doing and, if possible, off-load as much as possible to other processes, especially if you're preparing the index before searching it.

For example, some search engines manually go through each file when invoked. This is not a great idea, unless you only have few documents. It bogs the system and wastes cycles repeating processes that don't need to be repeated. If your material highly dynamic (it changes often), that may be different (depending on the way you've implemented it), so I'll keep it simple and assume that it's mostly static...

In your case, you should be able to come up with an indexing script that creates a universal index to your HTML documents and your database tables. You can rebuild the index manually simply by running the script from the command-prompt or you can have it rebuilt automatically through a cron job (which is generally adviseable, for it means you don't have to remember to run the indexer after adding content).

Your CGI users then run a second script that searches the "meta-index" and prepares the hit list, if any, of matches using data stored in your meta-index.

In general, it's always adviseable to review your code for those elements that can be streamlined, however, that's not always possible. Even if you're working under a deadline, however, there's generally time to go back (after delivery) and tweak things later. In my experience, users generally want changes of some form and those give you the opportunity to clean things up a bit, if you're careful.

--f


In reply to Re: "niceing" a CGI script by footpad
in thread "niceing" a CGI script by michellem

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.