Dreamer2345 / Forge-Level-Editor

This is a modular tile based level editor.
Other
4 stars 1 forks source link

Precompile map regex #68

Open Pharap opened 4 years ago

Pharap commented 4 years ago

Remembering what @filmote said about map loading taking a while, a quick-and-dirty solution might be to pass RegexOptions.Compiled to the mapLoadRegex's constructor.

This should internally cause the regex to be compiled to .Net bytecode, which should make it run faster. The downside is that it will increase program startup time, but that might be an acceptable tradeoff if compiling the regex improves map load times.

More info about RegexOptions.Compiled:


The proper solution for reading C++ code files is to use a proper parser instead of using regular expressions, but I don't think it's worth doing that at the moment.

Dreamer2345 commented 4 years ago

Yea, Sorry about this late reply It does seem a little overkill to include an entire c++ File parser...Though It would be good to make such a library independent of this ?

Pharap commented 4 years ago

It does seem a little overkill to include an entire c++ File parser...

If we were talking about nearly any other language I'd say it's a reasonable thing to do, but C++ is a context-sensitive language, which complicates matters.

Making a parser that parses a certain subset of C++ probably wouldn't be too bad, but we'd have to decide what that subset would be.

As things stand I put that in the "nice to have" bubble rather than the "necessary" bubble.

Though It would be good to make such a library independent of this ?

If there's a chance that more tools like this (in particular ones needing to read arrays from .h files) are going to be needed in the future then perhaps.