Repository navigation
Conversation
TextBase::getValue() skips translate+trim for an empty emptyValue (as getControl() already does); single-pass Rules iterator; MessageFormatter returns early without %; Message skips uksort for fewer than 2 parameters; renderer memoizes split wrapper keys; Operations::toValidator() dispatches on the operation directly; BaseControl::getErrors() returns early.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
TextBase::getValue()skips translate + trim whenemptyValue === ''(same guardgetControl()already uses).Rules::getIterator();Operations::toValidator()dispatches on the operation directly instead ofmatch(true)with a closure.MessageFormatterreturns early for messages without%;Validation\Messageskipsuksortfor fewer than 2 parameters;BaseControl::getErrors()returns early.DefaultFormRenderer::getValue()memoizes the split wrapper key.Why
These run per control, several times per submit and render.
Measured
30-control form, PHP 8.5, warm (tracing JIT): submit (build + validate + getValues) 221 -> 158 us (-28 %), render POST 601 -> 498 us (-17 %), render GET 474 -> 425 us, build -7..-9 %. Cold (fresh process): POST form 2227 -> 2061 us min (-7.5 %), GET 1797 -> 1761 us.
Measured together with the nette/component-model monitor PR; this PR alone excludes it.
Equivalence: rendered HTML, errors and values byte-identical for valid and invalid POST;
toValidator()checked on 13 440 op/arg/control cases including exceptions.Details: https://github.com/subnette/rfc-performance/blob/perf/round-2/docs/perf/round-2.md (round 3 numbers measured on current upstream master).
Tests
vendor/bin/tester tests -s -Con master: OK (123 tests)No behaviour change intended. A subclass overriding
translate()to turn '' into a non-empty string would see a difference ingetValue().