You are (probably) the only one who can answer that question. How big does your buffer get on average? How concerned are you about wasting memory? If you're not too concerned then setting SZSIZE to a really large value will probably give you the best performance. If you can accept a moderate ammount of waste then setting it to the average buffer size is probably good.
While writing HTML::Template::JIT I faced a similar problem. HTML::Template::JIT needs to accumulate generated HTML in a single buffer, but if I guess too low then the buffer might get copied around in memory during a realloc(). The solution I chose was to guess based on the size of the template and how many variables and loops were present how big the result would likely be.
Of course, whenever you're optimizing the first question should always be "does it really matter?". Try setting SZSIZE to 1 and do a benchmark run. Then set it to 8129 or some other highish value. If the difference is tiny stop immediately and do some profiling to find out where your problem really is! (Note that if I followed this advice HTML::Tempate::JIT wouldn't even exist...)
-sam
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.