Browse thread
[Caml-list] ANNOUNCE: mod_caml 1.0.6 - includes security patch
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Markus Mottl <markus@o...> |
| Subject: | Re: [Caml-list] ANNOUNCE: mod_caml 1.0.6 - includes security patch |
On Sat, 17 Jan 2004, Yutaka OIWA wrote: > The code generated by current Regexp/OCaml is something similar to the > above, (however, pattern compilations are performed only once per > execution per each pattern.) but if the backend regexp engine > (currently Regexp/OCaml uses PCRE/OCaml) supports optimization for > multiple regular expression matching, Regexp/OCaml can easily > utilize it. Analysis for patterns may be performed at compilation > (camlp4-translation) phase, if required. As mentioned in a previous post, this could be done using the callout features of PCRE-OCaml. Only problem: the string to be matched is internally copied to the C-heap (once), because the OCaml-GC could theoretically move the string to another memory location in the OCaml-heap during callouts. Thus, it may not be as efficient as you expect, and possibly only pay off if the patterns match the same, long string prefixes. Unfortunately, there is no workaround for this: you'd either have to rewrite PCRE so that you can return pointers to new string locations after each callout (no, thanks ;) or somehow be able to temporarily protect strings from being moved by the GC (not feasible either, I suppose; would, however, work with character strings in char Bigarrays if I am not mistaken). Regards, Markus -- Markus Mottl http://www.oefai.at/~markus markus@oefai.at ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners