| Age | Commit message (Collapse) | Author |
|
isSubsetOf builds a throwaway `MultiConstraint([candidate, constraint])` and
hands it to `Intervals::get`, whose cache key is the constraint's string form.
That MultiConstraint is fresh on every call, so its memoized string form is
always cold and the whole intersection has to be stringified recursively --
profiling put `AnyConstraint: Display::fmt` at 3.6 % of self time, more than
the interval computation the cache exists to skip.
Cache the answer on the pair of operand strings instead. Both operands are
long-lived, so each one's own string memo stays warm and the throwaway
intersection is never built on a hit.
laravel/framework require --no-install (warm cache, network disabled):
instructions:u 9885142257 -> 9142874710 (-7.5 %)
cycles:u 4858265879 -> 4444135669 (-8.5 %)
wall (hyperfine, 20 runs)
1.322 s +- 0.018 s -> 1.224 s +- 0.011 s (-7.4 %)
monolog/monolog is unchanged (101.6 ms -> 100.3 ms, within noise).
composer.lock is byte-identical for both packages.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Intervals::get() memoizes generateIntervals() results, but the port deep-cloned
the IntervalCollection out of the cache on every hit, where PHP hands the array
back by copy-on-write. On `require laravel/laravel` that is 282k calls, 99% of
them hits.
Store and return Arc<IntervalCollection> so a hit costs a refcount bump.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
PHP's version_compare takes its operator as a string, so the shim's port
did too, and Constraint carried two families of operator constants plus
translation tables to convert between the string form and its own int
codes. Five copies of those tables had accumulated across Constraint,
CompilingMatcher and the plugin value bridge.
version_compare now takes a CmpOp, which makes an invalid operator
unrepresentable and removes the tables' reason to exist. Constraint
stores a CmpOp and keeps only the string parsing its constructor needs;
getOperator, compile and CompilingMatcher::match speak CmpOp as well.
PHP's OP_* numbering stays observable: a plugin reads the raw integer off
the Constraint object over RPC, so get_operator_constant and its new
inverse hold that 0..5 mapping.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|
|
|
Replace the dyn ConstraintInterface trait objects with an AnyConstraint
enum closing over its four implementors (Simple, Multi, MatchAll,
MatchNone), mirroring the earlier Rule enum conversion. Rename
constraint.rs to simple_constraint.rs to match the renamed Constraint
type.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|
|
|
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
|
|
|
|
Add Clone derives to Constraint, Interval, and DevConstraintSet
(needed for IntervalCollection).
Add preg_match/preg_replace/preg_split stubs to shirabe-php-shim.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
|