[Issue 18114] [Reg 2.078] regex performance regression

2018-05-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18114

--- Comment #9 from Jon Degenhardt  ---
The final performance fix was included in LDC 1.10.0-beta1. For this release
the standard benchmark I used for the TSV Utilities improved as follows:

LDC 1.7.0 (before regression):  8.37 seconds
LDC 1.8.0 (after regression):  10.01 seconds
LDC 1.9.0 (first fixes):9.44 seconds
LDC 1.10.0-beta1 (second fix):  5.85 seconds

First fixes: Phobos PR 5981, DMD PR 7599
Second fix: Phobos PR 6268

The benchmark test used reads a TSV file line-by-line and checks individual
fields for regex matches. A significant amount of processing time is IO, so the
percentage gain on the regex portion is higher than the overall gain. The
overall gain from LDC 1.7.0 is 30%.

Test was run on MacOS, MacMini with 16GB RAM, SSD drives. The file used was
2.7GB, 14 million lines. Test info can be found here:
https://github.com/eBay/tsv-utils-dlang/blob/master/docs/ComparativeBenchmarks2018.md

Great result!

--


[Issue 18114] [Reg 2.078] regex performance regression

2018-03-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18114

--- Comment #8 from Jon Degenhardt  ---
I re-ran the benchmark with the new DMD 2.079.0 release (OS X). Numbers below
are fastest of several runs, but were generally consistent:

| Regex | 2.077.1  | 2.078.0-beta1 | 2.079.0  |
|---+--+---+--|
| 'abc' |  3819.314 ms |  6202.892 ms  |  5077.937 ms |
| '(aa)+(cc)+g' |  5457.678 ms |  8209.269 ms  |  6672.057 ms |
| '(aa|ax).+[gxb][cyw]' | 10121.181 ms | 12448.443 ms  | 11254.978 ms |

These results are a material improvement over 2.078.0-beta1, but still a fair
bit off 2.077.1, by 10-25% depending on the test.

Perhaps no longer a "performance regression", but there's still an opportunity
for improvement. Would it be more appropriate to leave this open as an
enhancement request?

--


[Issue 18114] [Reg 2.078] regex performance regression

2018-02-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18114

--- Comment #7 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/59520969ef73eaf0691972ee00b389e5bbc4c8fb
fix Issue 18114 - regex performance regression

- reduce copying of fat structs
- optimize layouts and opAssign of Captures

https://github.com/dlang/phobos/commit/460693c26f79a6aaa771ecdd42f791f4c3f5fb18
Merge pull request #5981 from MartinNowak/issue18114

fix Issue 18114 - regex performance regression
merged-on-behalf-of: Martin Nowak 

--


[Issue 18114] [Reg 2.078] regex performance regression

2018-02-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18114

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


[Issue 18114] [Reg 2.078] regex performance regression

2018-01-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18114

Martin Nowak  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #6 from Martin Nowak  ---
avoid inefficient codegen: https://github.com/dlang/dmd/pull/7599
WIP avoid unnecessary copies: https://github.com/dlang/phobos/pull/5981

--


[Issue 18114] [Reg 2.078] regex performance regression

2018-01-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18114

Martin Nowak  changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com,
   ||c...@dawg.eu,
   ||dmitry.o...@gmail.com
   Hardware|x86 |x86_64
Summary|dmd 2.078-beta1: regex  |[Reg 2.078] regex
   |performance regression  |performance regression
 OS|Mac OS X|All

--- Comment #5 from Martin Nowak  ---
Introduced by https://github.com/dlang/phobos/pull/5722.
There were some major internal changes in the std.regex module.

I see a 60% increase in issued instructions for the 'abc' regex, but also much
better ILP with this WIP PR.

https://github.com/dlang/phobos/pull/5981

There are quite a lot of very slow LOOP instructions used to copy fat struct
parameters around. Those seem to clog the pipeline.

https://github.com/dlang/dmd/blob/7f43f0f88df876aec60a22a6a74940020fb1ef50/src/dmd/backend/cod1.c#L4046
https://stackoverflow.com/questions/35742570/why-is-the-loop-instruction-slow-couldnt-intel-have-implemented-it-efficiently#35743699

Whether or not the increase in instructions with better ILP is intentional or
another bug, I don't know. Guess Dmitry can help to figure this out.

--