Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify AST expansion #99

Merged
merged 1 commit into from
Jul 30, 2024
Merged

Conversation

dag-erling
Copy link
Collaborator

Improved performance of retest with the patches in this PR (each data point is the time taken to run 10 times, lower is better):

x before
+ after
+------------------------------------------------------------------------------+
|   +                                                               x          |
|   +  +   +  +                                            x        x      x   |
|+  +  +   +  +                                            x     x  x   x  x  x|
|  |___MA___|                                                 |_____MA_____|   |
+------------------------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x  10          3.63          3.69          3.66         3.661   0.020248457
+  10          3.45          3.49          3.47         3.471   0.013703203
Difference at 95.0% confidence
	-0.19 +/- 0.0162441
	-5.18984% +/- 0.428046%
	(Student's t, pooled s = 0.0172884)

Improved performance of wretest with the patches in this PR (each data point is the time taken to run 10 times, lower is better):

x wbefore
+ wafter
+------------------------------------------------------------------------------+
|              +                                                   x           |
|         + +  +                                                x  x x  x      |
|+  +     + +  +  +                                             x  x x  x     x|
|     |____AM____|                                              |___MA___|     |
+------------------------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x  10          3.68          3.73         3.695         3.698   0.015491933
+  10          3.46          3.52           3.5         3.496   0.018973666
Difference at 95.0% confidence
	-0.202 +/- 0.0162743
	-5.46241% +/- 0.430629%
	(Student's t, pooled s = 0.0173205)

@dag-erling dag-erling force-pushed the des/expand-ast branch 2 times, most recently from 3388887 to b1a4e93 Compare April 26, 2024 11:33
@dag-erling dag-erling force-pushed the des/expand-ast branch 2 times, most recently from b1edf87 to f8a3e07 Compare June 30, 2024 17:29
In the final stage of expanding an iteration with a finite upper bound,
use the equivalent of (.(.(.)?)?)? instead of (|.(|.(|.))).  This saves
one AST node per iteration, reducing memory usage and very slightly
speeding up both AST expansion and AST-to-TNFA translation, although
the resulting TNFA appears unchanged in the cases I examined.  In
practical terms, retest and wretest both run a little over 5% faster
with this patch than without it.
@dag-erling dag-erling merged commit 11a32cb into laurikari:master Jul 30, 2024
2 checks passed
@dag-erling dag-erling deleted the des/expand-ast branch July 30, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant