Prefix factoring in Optimize node produces wrong results #44

Closed
opened 2018-04-16 22:30:08 +00:00 by pyscripter · 6 comments
pyscripter commented 2018-04-16 22:30:08 +00:00 (Migrated from github.com)
FLREInstance := tflre.Create('37|3|2', []);
Writeln(FLREInstance.DumpRegularExpression);

Result: (37|2)

If you comment out Prefix factoring lines 14495-a4586 the
Result: (37|3|2)

Issue #10 is related to this

``` FLREInstance := tflre.Create('37|3|2', []); Writeln(FLREInstance.DumpRegularExpression); ``` Result: (37|2) If you comment out Prefix factoring lines 14495-a4586 the Result: (37|3|2) Issue #10 is related to this
pyscripter commented 2018-04-16 23:23:54 +00:00 (Migrated from github.com)

The suffix factoring works fine. You can leave it in.

The suffix factoring works fine. You can leave it in.
BeRo1985 commented 2018-04-17 11:32:07 +00:00 (Migrated from github.com)

Please test the new possible fix for it.

Please test the new possible fix for it.
pyscripter commented 2018-04-17 13:57:20 +00:00 (Migrated from github.com)

It does work.
37|3|2
is converted to:
(3(?:7|(?:))|2)
which is correct. Is the above as efficient as
(37?|2)

It does work. 37|3|2 is converted to: (3(?:7|(?:))|2) which is correct. Is the above as efficient as (37?|2)
pyscripter commented 2018-04-17 14:04:39 +00:00 (Migrated from github.com)
By the way have a look at https://pyscripter.blogspot.gr/2018/04/benchmark-of-regular-expression-engines.html and https://plus.google.com/u/0/104825163436199563872/posts/GHcoEQ9M1pD
pyscripter commented 2018-04-17 14:07:18 +00:00 (Migrated from github.com)

Questiion:
In the above benchmark adding the rfONLYFASTOPTIMIZATIONS flag does not result in any degradation of speed. I guess this is because of the nature of the tested reg expressions. Is this the case?

Questiion: In the above benchmark adding the rfONLYFASTOPTIMIZATIONS flag does not result in any degradation of speed. I guess this is because of the nature of the tested reg expressions. Is this the case?
BeRo1985 commented 2018-04-17 14:37:42 +00:00 (Migrated from github.com)

Yes, right, but it depends also on the each-at-end-used subengines in FLRE, because some subengines don't care about so such optimizations in principle (for example the lazy-DFA-based), and some other subengines do care about it in turn.

Yes, right, but it depends also on the each-at-end-used subengines in FLRE, because some subengines don't care about so such optimizations in principle (for example the lazy-DFA-based), and some other subengines do care about it in turn.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
BeRo1985/flre#44
No description provided.