Re: [5/18] argv_ref speedup: add notion of quote age
"Gary V. Vaughan" <[email protected]>
| Newsgroups | gmane.comp.gnu.m4.patches |
|---|---|
| Message-ID | <[email protected]> |
Hi Eric, On 7 Dec 2007, at 22:14, Eric Blake wrote: > The next in the series. I hope I got everything correct on the head > - the > addition of changesyntax made porting this patch more interesting, > because > there were more corner cases to think about. In general, this patch > adds > some timing overhead, and has little impact on memory (on head, it > actually uses slightly less memory). > > The idea behind this patch is as follows. Since m4 allows > redefining the > behavior of the input engine on the fly (changequote, changecom, > changeword, changesyntax), we must ensure correct reparse in those > corner > cases. Our goal is to reparse text as few times as possible - once > text > has been parsed, we know what quoting rules it follows, so we cache > that > information alongside each string of parsed text. Then when > reparsing, we > can see if the quote age remains the same, in which case we don't > have to > waste time parsing that string, but can use the entire string as is. > Setting quote_age to be hardcoded to 0 will produce the same > results, but > without the benefit of reparsing. > > 2007-12-07 Eric Blake <[email protected]> > > Stage 5: add notion of quote age. > * src/input.c: Comment cleanups. > (current_quote_age): New global variable. > (set_quote_age): New helper function. > (input_init, set_word_regexp): Use it. > (set_quotes, set_comment): Likewise, and detect no-op changes. > (quote_age, safe_quotes): New functions. > (next_token): Track quote age. > * src/m4.h (struct token_data): Add quote_age member. > (TOKEN_DATA_QUOTE_AGE, quote_age, safe_quotes): New prototypes. > * src/macro.c (struct macro_arguments): Add quote_age member. > (expand_token): Alter signature and track quote age. > (expand_input, expand_argument): All callers changed. > (collect_arguments, make_argv_ref): Track quote age. > (arg_text, arg_len, arg_func): Detect type mismatch. > * doc/m4.texinfo (Ifelse, Changequote): Add more tests. > (Incompatibilities): Fix typo. > * examples/wraplifo.m4: New file. > * examples/Makefile.am (EXTRA_DIST): Distribute it. IMHO, the nice explanations you are giving above the ChangeLog entries in this patch series really belong inside the ChangeLog itself. I would have found understanding the semantics of the patches much harder without that extra text, and I suspect future readers of the ChangeLog and the changeset history would benefit equally. Cheers, Gary -- ())_. Email me: [email protected] ( '/ Read my blog: http://blog.azazil.net / )= ...and my book: http://sources.redhat.com/autobook `(_~)_ Join my AGLOCO Network: http://www.agloco.com/r/BBBS7912 _______________________________________________ M4-patches mailing list [email protected] http://lists.gnu.org/mailman/listinfo/m4-patches
PGP.sig
(application/pgp-signature, 186 B) - not displayed