[Issue 12844] New: Absurd RAM Required for ctRegex
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Jun 2 13:57:04 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12844
Issue ID: 12844
Summary: Absurd RAM Required for ctRegex
Product: D
Version: D2
Hardware: All
OS: Windows
Status: NEW
Keywords: CTFE, performance
Severity: major
Priority: P1
Component: Phobos
Assignee: nobody at puremagic.com
Reporter: blah38621 at gmail.com
Currently both git head and 2.065 take an utterly absurd (I killed DMD's
process at 9.5gb of ram usage, I only have 16gb of RAM so I can't test further
than that) amount of RAM to compile the following code:
module main;
import std.file : readText, write;
import std.math : round;
import std.regex;
enum planePattern = ctRegex!(`"plane" "\(([-]?[0-9]+(?:\.[0-9]+)?
[-]?[0-9]+(?:\.[0-9]+)? [-]?[0-9]+(?:\.[0-9]+)?)\) \(([-]?[0-9]+(?:\.[0-9]+)?
[-]?[0-9]+(?:\.[0-9]+)? [-]?[0-9]+(?:\.[0-9]+)?)\) \(([-]?[0-9]+(?:\.[0-9]+)?
[-]?[0-9]+(?:\.[0-9]+)? [-]?[0-9]+(?:\.[0-9]+)?)\)"`, "g");
void main(string[] args)
{
import std.stdio;
string dat = readText(args[0]);
foreach (m; planePattern.matchAll(dat))
{
writeln(m);
}
}
--
More information about the Digitalmars-d-bugs
mailing list