Skip to content

Persist persistent state in the processor. #773

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

Merged
merged 3 commits into from
Oct 18, 2024

Conversation

milseman
Copy link
Member

Refactor executor interfaces as well

New benchmark: word boundaries in urls

Comparing against saved benchmark result before_persist
=== Regressions ======================================================================
- CompilerMessages_All                    93.3ms	91.1ms	2.2ms		2.4%
- AnchoredNotFound_First                  10.2ms	9.25ms	961µs		10.4%
- NotFound_All                            6.66ms	5.76ms	903µs		15.7%
- CompilerMessages_All_Scalar             76.9ms	76ms	861µs		1.1%
- CaseInsensitiveCCC_All                  6.24ms	5.47ms	779µs		14.3%
- CaseInsensitiveCCC_All_Scalar           6.19ms	5.52ms	673µs		12.2%
- BasicCCC_All                            5.62ms	5.01ms	607µs		12.1%
- BasicCCC_All_Scalar                     5.62ms	5.03ms	589µs		11.7%
- LiteralSearchNotFound_All               5.62ms	5.04ms	578µs		11.5%
- LiteralSearch_All                       5.75ms	5.19ms	558µs		10.7%
- LiteralSearch_All_Scalar                4.75ms	4.37ms	382µs		8.8%
- NotFound_All_Scalar                     5.21ms	4.85ms	360µs		7.4%
- BasicRangeCCC_All_Scalar                5.96ms	5.62ms	347µs		6.2%
- LiteralSearchNotFound_All_Scalar        4.62ms	4.28ms	343µs		8.0%
- BasicRangeCCC_All                       5.93ms	5.62ms	304µs		5.4%
- ReluctantQuantWithTerminal_Whole_Scalar 6.09ms	5.79ms	295µs		5.1%
- ReluctantQuantWithTerminal_Whole        6.05ms	5.79ms	256µs		4.4%
- AnchoredNotFound_First_Scalar           6.15ms	5.94ms	205µs		3.5%
- URLWithWordBoundaries_All_SimpleWordBoundaries 914µs	834µs	80.2µs		9.6%
- EmailLookaheadList_Scalar               4.2ms	4.14ms	61.3µs		1.5%
- HangulSyllable_First                    2.71ms	2.68ms	24.3µs		0.9%
- MACAddress                              2.55ms	2.53ms	18.1µs		0.7%
=== Improvements =====================================================================
- URLWithWordBoundaries_All               3.86ms	90.1ms	-86.2ms		-95.7%
- URLWithWordBoundaries_All_Scalar        3.63ms	89.9ms	-86.2ms		-96.0%
- InvertedCCC_All                         7.24ms	18.5ms	-11.2ms		-60.8%
- InvertedCCC_All_Scalar                  7.25ms	18.4ms	-11.2ms		-60.7%
- DiceRollsInText_All_Scalar              30.2ms	41.3ms	-11.1ms		-26.9%
- DiceRollsInText_All                     32.4ms	43.4ms	-11ms		-25.4%
- Words_All_Scalar                        5.71ms	13ms	-7.31ms		-56.1%
- Words_All                               6.13ms	13.4ms	-7.22ms		-54.1%
- AnchoredNotFound_All                    10.2ms	13.8ms	-3.61ms		-26.1%
- AnchoredNotFound_All_Scalar             6.18ms	9.45ms	-3.27ms		-34.6%
- EmailRFC_All                            33ms	35ms	-1.93ms		-5.5%
- BasicBuiltinCharacterClass_All_Scalar   4.35ms	6.11ms	-1.76ms		-28.8%
- EmailBuiltinCharacterClass_All          9.43ms	11.2ms	-1.74ms		-15.6%
- EmailBuiltinCharacterClass_All_Scalar   9.27ms	10.9ms	-1.68ms		-15.3%
- EmailRFC_All_Scalar                     32ms	33.6ms	-1.58ms		-4.7%
- BasicBuiltinCharacterClass_All          5.66ms	7.09ms	-1.43ms		-20.1%
- symDiffCCC_All_Scalar                   19.6ms	21ms	-1.41ms		-6.7%
- GraphemeBreakNoCap_All_Scalar           1.71ms	3.09ms	-1.37ms		-44.5%
- symDiffCCC_All                          19.6ms	20.9ms	-1.34ms		-6.4%
- GraphemeBreakNoCap_All                  1.9ms	3.21ms	-1.31ms		-40.7%
- EmojiRegex_All_Scalar                   45.9ms	47.2ms	-1.3ms		-2.7%
- SubtractionCCC_All                      7.74ms	8.85ms	-1.11ms		-12.6%
- SubtractionCCC_All_Scalar               7.77ms	8.83ms	-1.05ms		-11.9%
- EmojiRegex_All                          126ms	127ms	-1.02ms		-0.8%
- Lines_All_Scalar                        970µs	1.81ms	-837µs		-46.3%
- Lines_All                               1.03ms	1.87ms	-837µs		-44.8%
- HangulSyllable_All_Scalar               4.3ms	5.09ms	-795µs		-15.6%
- EmailRFCNoMatches_All_Scalar            47ms	47.8ms	-729µs		-1.5%
- IntersectionCCC_All                     7.35ms	8.08ms	-725µs		-9.0%
- IntersectionCCC_All_Scalar              7.35ms	8.07ms	-724µs		-9.0%
- EmailLookahead_All_Scalar               18.3ms	19ms	-706µs		-3.7%
- HangulSyllable_All                      5.06ms	5.72ms	-656µs		-11.5%
- EmailLookahead_All                      20.4ms	21.1ms	-620µs		-2.9%
- Numbers_All_Scalar                      3.95ms	4.48ms	-531µs		-11.8%
- EmailRFCNoMatches_All                   51.5ms	52ms	-503µs		-1.0%
- Numbers_All                             4.76ms	5.15ms	-395µs		-7.7%
- EmailLookaheadNoMatches_All_Scalar      21.8ms	22.2ms	-365µs		-1.6%
- ReluctantQuant_Whole_Scalar             9.87ms	10.2ms	-287µs		-2.8%
- ReluctantQuant_Whole                    9.86ms	10.1ms	-237µs		-2.3%
- Css_All_Scalar                          2.78ms	2.95ms	-166µs		-5.6%
- Css_All                                 3.13ms	3.25ms	-117µs		-3.6%
- IPv6Address_Scalar                      2.46ms	2.51ms	-52.4µs		-2.1%
- HangulSyllable_First_Scalar             2.24ms	2.28ms	-34.5µs		-1.5%
- IPv4Address_Scalar                      2.2ms	2.23ms	-25.7µs		-1.2%
- MACAddress_Scalar                       2.42ms	2.44ms	-22.8µs		-0.9%

@milseman milseman requested a review from natecook1000 October 10, 2024 21:21
@milseman
Copy link
Member Author

Fixes #770

@milseman
Copy link
Member Author

@swift-ci please test

@milseman
Copy link
Member Author

Most of those perf swings (including regressions) are from refactoring the interface itself.

Refactoring-only:

=== Regressions ======================================================================
- CompilerMessages_All                    91.4ms	90.1ms	1.29ms		1.4%
- NotFound_All                            6.45ms	5.63ms	827µs		14.7%
- BasicRangeCCC_All                       6.23ms	5.46ms	770µs		14.1%
- BasicRangeCCC_All_Scalar                6.17ms	5.46ms	709µs		13.0%
- BasicCCC_All_Scalar                     5.62ms	4.92ms	692µs		14.0%
- BasicCCC_All                            5.6ms	4.93ms	673µs		13.7%
- CaseInsensitiveCCC_All                  6.02ms	5.35ms	672µs		12.6%
- CaseInsensitiveCCC_All_Scalar           6.01ms	5.35ms	662µs		12.4%
- AnchoredNotFound_First                  9.65ms	9.07ms	587µs		6.5%
- LiteralSearchNotFound_All               5.5ms	5ms	498µs		10.0%
- LiteralSearch_All_Scalar                4.77ms	4.3ms	471µs		10.9%
- LiteralSearchNotFound_All_Scalar        4.62ms	4.17ms	456µs		10.9%
- Numbers_All                             5.37ms	5.03ms	340µs		6.8%
- NotFound_All_Scalar                     5.04ms	4.74ms	294µs		6.2%
- EmailLookaheadNoMatches_All             24.2ms	24ms	239µs		1.0%
- BasicBuiltinCharacterClass_All          7.29ms	7.06ms	231µs		3.3%
- LiteralSearch_All                       5.77ms	5.61ms	168µs		3.0%
- HangulSyllable_All                      5.7ms	5.55ms	150µs		2.7%
- Numbers_All_Scalar                      4.47ms	4.33ms	147µs		3.4%
- DiceNotation                            4.88ms	4.75ms	128µs		2.7%
- ReluctantQuant_Whole_Scalar             10.1ms	9.98ms	125µs		1.3%
- EmailLookahead_All                      20.8ms	20.6ms	118µs		0.6%
- BasicBuiltinCharacterClass_All_Scalar   6.05ms	5.94ms	111µs		1.9%
- MACAddress                              2.59ms	2.49ms	98.7µs		4.0%
- Css_All                                 3.29ms	3.19ms	95.4µs		3.0%
- URLWithWordBoundaries_All_SimpleWordBoundaries 914µs	821µs	93.8µs		11.4%
- HangulSyllable_First                    2.72ms	2.63ms	90.4µs		3.4%
- AnchoredNotFound_First_Scalar           5.87ms	5.8ms	68.5µs		1.2%
- HangulSyllable_All_Scalar               4.99ms	4.92ms	64.1µs		1.3%
- DiceNotation_Scalar                     4.57ms	4.52ms	49.8µs		1.1%
- IPv6Address                             2.58ms	2.56ms	20.1µs		0.8%
- IPv6Address_Scalar                      2.43ms	2.41ms	18.2µs		0.8%
- EagarQuantWithTerminal_Whole_Scalar     454µs	441µs	13.8µs		3.1%
=== Improvements =====================================================================
- AnchoredNotFound_All                    9.7ms	13.6ms	-3.87ms		-28.5%
- AnchoredNotFound_All_Scalar             5.86ms	9.26ms	-3.4ms		-36.8%
- InvertedCCC_All                         16ms	18ms	-2.02ms		-11.2%
- InvertedCCC_All_Scalar                  16.2ms	18ms	-1.87ms		-10.4%
- EmojiRegex_All_Scalar                   44.7ms	46.3ms	-1.63ms		-3.5%
- Words_All_Scalar                        11.5ms	13ms	-1.51ms		-11.7%
- Words_All                               11.9ms	13.3ms	-1.38ms		-10.4%
- DiceRollsInText_All_Scalar              39.2ms	40.4ms	-1.24ms		-3.1%
- DiceRollsInText_All                     41.5ms	42.5ms	-1.03ms		-2.4%
- IntersectionCCC_All_Scalar              7.12ms	8.03ms	-914µs		-11.4%
- SubtractionCCC_All                      7.88ms	8.71ms	-825µs		-9.5%
- symDiffCCC_All_Scalar                   19.6ms	20.4ms	-811µs		-4.0%
- IntersectionCCC_All                     7.08ms	7.89ms	-809µs		-10.3%
- SubtractionCCC_All_Scalar               7.89ms	8.69ms	-805µs		-9.3%
- symDiffCCC_All                          19.6ms	20.4ms	-804µs		-3.9%
- EmailBuiltinCharacterClass_All_Scalar   10.4ms	11ms	-678µs		-6.1%
- EmailRFC_All_Scalar                     32.6ms	33ms	-430µs		-1.3%
- EmailBuiltinCharacterClass_All          10.6ms	10.8ms	-222µs		-2.1%
- IPv4Address_Scalar                      2.13ms	2.35ms	-212µs		-9.1%
- GraphemeBreakNoCap_All_Scalar           2.85ms	3.03ms	-179µs		-5.9%
- IPv4Address                             2.29ms	2.47ms	-178µs		-7.2%
- GraphemeBreakNoCap_All                  2.99ms	3.15ms	-151µs		-4.8%
- Lines_All                               1.71ms	1.85ms	-136µs		-7.3%
- Lines_All_Scalar                        1.68ms	1.8ms	-113µs		-6.3%

New iteration model vs post-refactoring:

=== Regressions ======================================================================
- CompilerMessages_All                    92ms	91.4ms	628µs		0.7%
- AnchoredNotFound_First                  10.1ms	9.65ms	431µs		4.5%
- AnchoredNotFound_All                    10.1ms	9.7ms	430µs		4.4%
- AnchoredNotFound_First_Scalar           6.2ms	5.87ms	336µs		5.7%
- EmojiRegex_All_Scalar                   45ms	44.7ms	275µs		0.6%
- AnchoredNotFound_All_Scalar             6.08ms	5.86ms	226µs		3.9%
- MACAddress_Scalar                       2.52ms	2.35ms	166µs		7.1%
- LiteralSearchNotFound_All_Scalar        4.77ms	4.62ms	145µs		3.1%
- ReluctantQuantWithTerminal_Whole_Scalar 5.94ms	5.81ms	139µs		2.4%
- DiceNotation_Scalar                     4.7ms	4.57ms	132µs		2.9%
- NotFound_All_Scalar                     5.17ms	5.04ms	131µs		2.6%
- IntersectionCCC_All                     7.2ms	7.08ms	128µs		1.8%
- LiteralSearchNotFound_All               5.61ms	5.5ms	111µs		2.0%
- ReluctantQuantWithTerminal_Whole        5.93ms	5.83ms	105µs		1.8%
- EmailLookaheadList_Scalar               4.16ms	4.06ms	101µs		2.5%
- IntersectionCCC_All_Scalar              7.22ms	7.12ms	96.9µs		1.4%
- NotFound_All                            6.54ms	6.45ms	90µs		1.4%
- MACAddress                              2.64ms	2.59ms	54.3µs		2.1%
- IPv4Address_Scalar                      2.19ms	2.13ms	53.1µs		2.5%
- LiteralSearch_All_Scalar                4.8ms	4.77ms	33.4µs		0.7%
- IPv4Address                             2.31ms	2.29ms	26.7µs		1.2%
=== Improvements =====================================================================
- URLWithWordBoundaries_All               3.77ms	88.4ms	-84.6ms		-95.7%
- URLWithWordBoundaries_All_Scalar        3.59ms	88.2ms	-84.6ms		-95.9%
- DiceRollsInText_All                     31.5ms	41.5ms	-9.94ms		-24.0%
- DiceRollsInText_All_Scalar              29.4ms	39.2ms	-9.8ms		-25.0%
- InvertedCCC_All                         7.04ms	16ms	-8.98ms		-56.1%
- InvertedCCC_All_Scalar                  7.53ms	16.2ms	-8.63ms		-53.4%
- Words_All                               5.96ms	11.9ms	-5.96ms		-50.0%
- Words_All_Scalar                        5.59ms	11.5ms	-5.87ms		-51.2%
- BasicBuiltinCharacterClass_All_Scalar   4.24ms	6.05ms	-1.82ms		-30.0%
- BasicBuiltinCharacterClass_All          5.53ms	7.29ms	-1.76ms		-24.2%
- EmailBuiltinCharacterClass_All          9.25ms	10.6ms	-1.33ms		-12.6%
- GraphemeBreakNoCap_All                  1.82ms	2.99ms	-1.18ms		-39.3%
- GraphemeBreakNoCap_All_Scalar           1.71ms	2.85ms	-1.14ms		-40.1%
- EmailBuiltinCharacterClass_All_Scalar   9.25ms	10.4ms	-1.12ms		-10.8%
- EmailRFC_All                            33ms	34.1ms	-1.04ms		-3.1%
- EmailRFC_All_Scalar                     31.8ms	32.6ms	-799µs		-2.5%
- symDiffCCC_All                          18.8ms	19.6ms	-784µs		-4.0%
- HangulSyllable_All_Scalar               4.25ms	4.99ms	-740µs		-14.8%
- EmailLookahead_All                      20ms	20.8ms	-736µs		-3.5%
- Numbers_All                             4.64ms	5.37ms	-725µs		-13.5%
- Lines_All_Scalar                        982µs	1.68ms	-701µs		-41.6%
- Numbers_All_Scalar                      3.79ms	4.47ms	-683µs		-15.3%
- Lines_All                               1.04ms	1.71ms	-674µs		-39.4%
- EmailLookahead_All_Scalar               18ms	18.6ms	-579µs		-3.1%
- symDiffCCC_All_Scalar                   19.1ms	19.6ms	-507µs		-2.6%
- ReluctantQuant_Whole_Scalar             9.7ms	10.1ms	-410µs		-4.1%
- HangulSyllable_All                      5.38ms	5.7ms	-319µs		-5.6%
- SubtractionCCC_All_Scalar               7.58ms	7.89ms	-302µs		-3.8%
- BasicRangeCCC_All                       5.96ms	6.23ms	-265µs		-4.3%
- Css_All_Scalar                          2.73ms	2.96ms	-237µs		-8.0%
- SubtractionCCC_All                      7.64ms	7.88ms	-237µs		-3.0%
- BasicRangeCCC_All_Scalar                5.94ms	6.17ms	-229µs		-3.7%
- Css_All                                 3.07ms	3.29ms	-218µs		-6.6%
- EmailLookaheadNoMatches_All             24.1ms	24.2ms	-133µs		-0.6%
- HangulSyllable_First_Scalar             2.21ms	2.26ms	-48.2µs		-2.1%
- HangulSyllable_First                    2.68ms	2.72ms	-43.8µs		-1.6%
- IPv6Address                             2.55ms	2.58ms	-27.8µs		-1.1%
- EagarQuantWithTerminal_Whole_Scalar     440µs	454µs	-13.9µs		-3.1%

@milseman
Copy link
Member Author

@swift-ci please test

1 similar comment
@milseman
Copy link
Member Author

@swift-ci please test

subjectBounds: Range<String.Index>,
searchBounds: Range<String.Index>
) -> Matches {
fatalError()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this method superfluous now? I don't see it called anywhere…

// subjectBounds: subjectBounds,
// searchBounds: searchBounds,
// graphemeSemantic: graphemeSemantic)
// }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove these leftovers?

@natecook1000
Copy link
Member

@swift-ci Please test

@milseman
Copy link
Member Author

@swift-ci please test

1 similar comment
@milseman
Copy link
Member Author

@swift-ci please test

@milseman
Copy link
Member Author

rdar://137607522

@milseman milseman mentioned this pull request Oct 12, 2024
@shahmishal
Copy link
Member

@swift-ci test

@milseman
Copy link
Member Author

@swift-ci please test macOS platform

2 similar comments
@milseman
Copy link
Member Author

@swift-ci please test macOS platform

@milseman
Copy link
Member Author

@swift-ci please test macOS platform

@milseman milseman merged commit 768ed79 into swiftlang:main Oct 18, 2024
2 checks passed
@milseman milseman deleted the persist_state branch October 18, 2024 15:50
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.

3 participants