mirror of https://github.com/adamdruppe/arsd.git
ct to regular regex for compile speed boost
This commit is contained in:
parent
3970db0891
commit
ff68e1cf00
7
cgi.d
7
cgi.d
|
@ -2073,7 +2073,12 @@ struct Uri {
|
||||||
private void reparse(string uri) {
|
private void reparse(string uri) {
|
||||||
import std.regex;
|
import std.regex;
|
||||||
// from RFC 3986
|
// 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);
|
auto m = match(uri, ctr);
|
||||||
if(m) {
|
if(m) {
|
||||||
scheme = m.captures[2];
|
scheme = m.captures[2];
|
||||||
|
|
Loading…
Reference in New Issue