From ff68e1cf004861dcf256fce996bec851c7c0e208 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Mon, 22 Dec 2014 13:52:21 -0500 Subject: [PATCH] ct to regular regex for compile speed boost --- cgi.d | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cgi.d b/cgi.d index 7df4c46..716871c 100644 --- a/cgi.d +++ b/cgi.d @@ -2073,7 +2073,12 @@ struct Uri { private void reparse(string uri) { import std.regex; // from RFC 3986 - enum ctr = ctRegex!r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?"; + + // the ctRegex triples the compile time and makes ugly errors for no real benefit + // it was a nice experiment but just not worth it. + // enum ctr = ctRegex!r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?"; + auto ctr = regex(r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?"); + auto m = match(uri, ctr); if(m) { scheme = m.captures[2];