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

feat(types): Traceless types #453

Merged
merged 5 commits into from
Apr 2, 2024
Merged

feat(types): Traceless types #453

merged 5 commits into from
Apr 2, 2024

Conversation

veewee
Copy link
Collaborator

@veewee veewee commented Mar 27, 2024

Fixes #412
Closes #429

This PR will:

  • Speed up type coerce + assert by removing the trace completely.
  • Improve the error message by nesting the various given exceptions (whilst keeping track of current path).

This will result in errors that look like:

Expected "array{'name': string, 'articles': vec<array{'title': string, 'content': string, 'likes': int, 'comments'?: vec<array{'user': string, 'comment': string}>}>, 'dictionary': dict<string, vec<array{'title': string, 'content': string}>>, 'pagination'?: array{'currentPage': uint, 'totalPages': uint, 'perPage': uint, 'totalRows': uint}}", got "array" at path "articles.0.comments.0".

With an exception stack like:

Psl\Type\Exception\AssertException: Expected "array{'user': string, 'comment': string}", got "array". in /azjezz/psl/src/Psl/Type/Exception/AssertException.php:46
Stack trace:
0 /azjezz/psl/src/Psl/Type/Internal/ShapeType.php(171): Psl\Type\Exception\AssertException::withValue(Array, 'array{'user': s...')
1 /azjezz/psl/src/Psl/Type/Type.php(70): Psl\Type\Internal\ShapeType->assert(Array)
2 /azjezz/psl/src/Psl/Type/Internal/VecType.php(93): Psl\Type\Type->assertChildType(Object(Psl\Type\Internal\ShapeType), Array, '0')
3 /azjezz/psl/src/Psl/Type/Internal/OptionalType.php(47): Psl\Type\Internal\VecType->assert(Array)
4 /azjezz/psl/src/Psl/Type/Type.php(70): Psl\Type\Internal\OptionalType->assert(Array)
5 /azjezz/psl/src/Psl/Type/Internal/ShapeType.php(162): Psl\Type\Type->assertChildType(Object(Psl\Type\Internal\OptionalType), Array, 'comments')
6 /azjezz/psl/src/Psl/Type/Type.php(70): Psl\Type\Internal\ShapeType->assert(Array)
7 /azjezz/psl/src/Psl/Type/Internal/VecType.php(93): Psl\Type\Type->assertChildType(Object(Psl\Type\Internal\ShapeType), Array, '0')
8 /azjezz/psl/src/Psl/Type/Type.php(70): Psl\Type\Internal\VecType->assert(Array)
9 /azjezz/psl/src/Psl/Type/Internal/ShapeType.php(162): Psl\Type\Type->assertChildType(Object(Psl\Type\Internal\VecType), Array, 'articles')
10 /azjezz/psl/test.php(31): Psl\Type\Internal\ShapeType->assert(Array)
11 {main}

Next Psl\Type\Exception\AssertException: Expected "vec<array{'user': string, 'comment': string}>", got "array" at path "0". in /azjezz/psl/src/Psl/Type/Exception/AssertException.php:46
Stack trace:
0 /azjezz/psl/src/Psl/Type/Type.php(72): Psl\Type\Exception\AssertException::withValue(Array, 'vec<array{'user...', '0', Object(Psl\Type\Exception\AssertException))
1 /azjezz/psl/src/Psl/Type/Internal/VecType.php(93): Psl\Type\Type->assertChildType(Object(Psl\Type\Internal\ShapeType), Array, '0')
2 /azjezz/psl/src/Psl/Type/Internal/OptionalType.php(47): Psl\Type\Internal\VecType->assert(Array)
3 /azjezz/psl/src/Psl/Type/Type.php(70): Psl\Type\Internal\OptionalType->assert(Array)
4 /azjezz/psl/src/Psl/Type/Internal/ShapeType.php(162): Psl\Type\Type->assertChildType(Object(Psl\Type\Internal\OptionalType), Array, 'comments')
5 /azjezz/psl/src/Psl/Type/Type.php(70): Psl\Type\Internal\ShapeType->assert(Array)
6 /azjezz/psl/src/Psl/Type/Internal/VecType.php(93): Psl\Type\Type->assertChildType(Object(Psl\Type\Internal\ShapeType), Array, '0')
7 /azjezz/psl/src/Psl/Type/Type.php(70): Psl\Type\Internal\VecType->assert(Array)
8 /azjezz/psl/src/Psl/Type/Internal/ShapeType.php(162): Psl\Type\Type-> assertChildType(Object(Psl\Type\Internal\VecType), Array, 'articles')
9 /azjezz/psl/test.php(31): Psl\Type\Internal\ShapeType->assert(Array)
10 {main}

Next Psl\Type\Exception\AssertException: Expected "array{'title': string, 'content': string, 'likes': int, 'comments'?: vec<array{'user': string, 'comment': string}>}", got "array" at path "comments.0". in /azjezz/psl/src/Psl/Type/Exception/AssertException.php:46
Stack trace:
0 /azjezz/psl/src/Psl/Type/Type.php(72): Psl\Type\Exception\AssertException::withValue(Array, 'array{'title': ...', 'comments', Object(Psl\Type\Exception\AssertException))
1 /azjezz/psl/src/Psl/Type/Internal/ShapeType.php(162): Psl\Type\Type->assertChildType(Object(Psl\Type\Internal\OptionalType), Array, 'comments')
2 /azjezz/psl/src/Psl/Type/Type.php(70): Psl\Type\Internal\ShapeType->assert(Array)
3 /azjezz/psl/src/Psl/Type/Internal/VecType.php(93): Psl\Type\Type->assertChildType(Object(Psl\Type\Internal\ShapeType), Array, '0')
4 /azjezz/psl/src/Psl/Type/Type.php(70): Psl\Type\Internal\VecType->assert(Array)
5 /azjezz/psl/src/Psl/Type/Internal/ShapeType.php(162): Psl\Type\Type->assertChildType(Object(Psl\Type\Internal\VecType), Array, 'articles')
6 /azjezz/psl/test.php(31): Psl\Type\Internal\ShapeType->assert(Array)
7 {main}

Next Psl\Type\Exception\AssertException: Expected "vec<array{'title': string, 'content': string, 'likes': int, 'comments'?: vec<array{'user': string, 'comment': string}>}>", got "array" at path "0.comments.0". in /azjezz/psl/src/Psl/Type/Exception/AssertException.php:46
Stack trace:
0 /azjezz/psl/src/Psl/Type/Type.php(72): Psl\Type\Exception\AssertException::withValue(Array, 'vec<array{'titl...', '0', Object(Psl\Type\Exception\AssertException))
1 /azjezz/psl/src/Psl/Type/Internal/VecType.php(93): Psl\Type\Type->assertChildType(Object(Psl\Type\Internal\ShapeType), Array, '0')
2 /azjezz/psl/src/Psl/Type/Type.php(70): Psl\Type\Internal\VecType->assert(Array)
3 /azjezz/psl/src/Psl/Type/Internal/ShapeType.php(162): Psl\Type\Type->assertChildType(Object(Psl\Type\Internal\VecType), Array, 'articles')
4 /azjezz/psl/test.php(31): Psl\Type\Internal\ShapeType->assert(Array)
5 {main}

Next Psl\Type\Exception\AssertException: Expected "array{'name': string, 'articles': vec<array{'title': string, 'content': string, 'likes': int, 'comments'?: vec<array{'user': string, 'comment': string}>}>, 'dictionary': dict<string, vec<array{'title': string, 'content': string}>>, 'pagination'?: array{'currentPage': uint, 'totalPages': uint, 'perPage': uint, 'totalRows': uint}}", got "array" at path "articles.0.comments.0". in /azjezz/psl/src/Psl/Type/Exception/AssertException.php:46
Stack trace:
0 /azjezz/psl/src/Psl/Type/Type.php(72): Psl\Type\Exception\AssertException::withValue(Array, 'array{'name': s...', 'articles', Object(Psl\Type\Exception\AssertException))
1 /azjezz/psl/src/Psl/Type/Internal/ShapeType.php(162): Psl\Type\Type->assertChildType(Object(Psl\Type\Internal\VecType), Array, 'articles')
2 /azjezz/psl/test.php(31): Psl\Type\Internal\ShapeType->assert(Array)
3 {main}

The benchmarks results look promising:

Screenshot 2024-03-28 at 15 00 36
Screenshot 2024-03-28 at 15 00 44
Screenshot 2024-03-28 at 15 00 49

@veewee veewee added Priority: Medium This issue may be useful, and needs some attention. Status: In Progress This issue is being worked on, and has someone assigned. Type: Enhancement Most issues will probably ask for additions or changes. Type: BC Break A change that will result in a backward compatibility break in the public API. labels Mar 27, 2024
@veewee veewee added this to the 3.0.0 milestone Mar 27, 2024
@veewee veewee marked this pull request as draft March 27, 2024 15:05
src/Psl/Type/TypeInterface.php Show resolved Hide resolved
src/Psl/Type/Internal/VecType.php Outdated Show resolved Hide resolved
tests/unit/Type/Exception/TypeAssertExceptionTest.php Outdated Show resolved Hide resolved
@veewee veewee force-pushed the traceless-types branch 3 times, most recently from 597b727 to ccb5c11 Compare March 28, 2024 18:53
@coveralls
Copy link

coveralls commented Mar 28, 2024

Pull Request Test Coverage Report for Build 8489083056

Details

  • 422 of 425 (99.29%) changed or added relevant lines in 47 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.05%) to 98.973%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/Psl/Type/Internal/NonEmptyVecType.php 20 23 86.96%
Totals Coverage Status
Change from base Build 8488431262: -0.05%
Covered Lines: 4337
Relevant Lines: 4382

💛 - Coveralls

@veewee veewee force-pushed the traceless-types branch 5 times, most recently from eebe170 to 72e9653 Compare March 28, 2024 19:40
src/Psl/Type/Internal/DictType.php Outdated Show resolved Hide resolved
src/Psl/Type/Internal/VecType.php Outdated Show resolved Hide resolved
@veewee
Copy link
Collaborator Author

veewee commented Mar 29, 2024

Final bench results

PHPBench (1.2.14) running benchmarks... #standwithukraine
with configuration file: /Users/verweto/Projects/github/azjezz/psl/config/phpbench.json
with PHP version 8.2.10, xdebug ❌, opcache ❌
comparing [actual vs. benchmark_reference]

\Psl\Tests\Benchmark\Channel\CommunicationBench

    benchBoundedCommunication...............R1 I2 - [Mo2.715ms vs. Mo3.038ms] -10.65% (±2.41%)
    benchUnboundedCommunication.............R1 I4 - [Mo2.544ms vs. Mo2.785ms] -8.66% (±2.15%)

\Psl\Tests\Benchmark\Type\VecTypeBench

    benchCoerce # mixed, empty array........R1 I4 - [Mo0.143μs vs. Mo0.504μs] -71.62% (±2.60%)
    benchCoerce # mixed, empty iterable.....R1 I1 - [Mo0.180μs vs. Mo0.520μs] -65.36% (±0.00%)
    benchCoerce # mixed, non-empty array....R1 I1 - [Mo0.331μs vs. Mo0.800μs] -58.67% (±1.20%)
    benchCoerce # mixed, non-empty iterable.R1 I3 - [Mo0.467μs vs. Mo1.162μs] -59.79% (±3.22%)
    benchCoerce # mixed, large array........R1 I2 - [Mo5.372μs vs. Mo9.063μs] -40.72% (±1.22%)
    benchCoerce # mixed, large iterable.....R2 I2 - [Mo8.234μs vs. Mo8.911μs] -7.60% (±2.07%)
    benchCoerce # int, empty array..........R5 I4 - [Mo0.150μs vs. Mo0.602μs] -75.10% (±1.34%)
    benchCoerce # int, empty iterable.......R5 I4 - [Mo0.180μs vs. Mo0.641μs] -71.90% (±1.10%)
    benchCoerce # int, non-empty array......R1 I4 - [Mo0.357μs vs. Mo0.816μs] -56.25% (±1.24%)
    benchCoerce # int, non-empty iterable...R2 I2 - [Mo0.542μs vs. Mo0.993μs] -45.40% (±1.36%)
    benchAssert # mixed, empty array........R5 I4 - [Mo0.150μs vs. Mo0.595μs] -74.81% (±1.34%)
    benchAssert # mixed, non-empty array....R1 I2 - [Mo0.328μs vs. Mo0.768μs] -57.36% (±2.02%)
    benchAssert # mixed, large array........R1 I4 - [Mo5.147μs vs. Mo6.062μs] -15.09% (±2.79%)
    benchAssert # int, empty array..........R5 I4 - [Mo0.150μs vs. Mo0.532μs] -71.83% (±1.32%)
    benchAssert # int, non-empty array......R1 I1 - [Mo0.340μs vs. Mo0.665μs] -48.86% (±0.72%)
    benchMatch # mixed, empty array.........R1 I4 - [Mo0.130μs vs. Mo0.128μs] +1.39% (±1.91%)
    benchMatch # mixed, non-empty array.....R1 I4 - [Mo0.280μs vs. Mo0.349μs] -19.76% (±1.13%)
    benchMatch # mixed, large array.........R1 I4 - [Mo4.645μs vs. Mo4.566μs] +1.72% (±3.01%)
    benchMatch # int, empty array...........R2 I1 - [Mo0.125μs vs. Mo0.130μs] -3.72% (±0.00%)
    benchMatch # int, non-empty array.......R2 I4 - [Mo0.286μs vs. Mo0.360μs] -20.69% (±1.39%)

\Psl\Tests\Benchmark\Type\DictTypeBench

    benchCoerce # generic array, empty arra.R2 I4 - [Mo0.153μs vs. Mo1.011μs] -84.86% (±2.43%)
    benchCoerce # generic array, empty iter.R5 I4 - [Mo0.195μs vs. Mo1.050μs] -81.44% (±1.62%)
    benchCoerce # generic array, non-empty .R1 I4 - [Mo0.328μs vs. Mo1.013μs] -67.62% (±2.67%)
    benchCoerce # generic array, non-empty .R5 I4 - [Mo0.399μs vs. Mo1.274μs] -68.66% (±1.22%)
    benchCoerce # generic array, large arra.R1 I2 - [Mo12.588μs vs. Mo14.764μs] -14.74% (±2.17%)
    benchCoerce # generic array, large iter.R1 I4 - [Mo15.821μs vs. Mo18.379μs] -13.92% (±0.20%)
    benchCoerce # int array, empty array....R1 I4 - [Mo0.155μs vs. Mo0.917μs] -83.10% (±2.04%)
    benchCoerce # int array, empty iterable.R1 I4 - [Mo0.195μs vs. Mo1.020μs] -80.89% (±1.62%)
    benchCoerce # int array, non-empty arra.R1 I4 - [Mo0.513μs vs. Mo1.391μs] -63.13% (±1.13%)
    benchCoerce # int array, non-empty iter.R1 I4 - [Mo0.643μs vs. Mo1.494μs] -56.98% (±1.66%)
    benchCoerce # int array, large array....R1 I2 - [Mo10.339μs vs. Mo11.148μs] -7.25% (±1.38%)
    benchCoerce # int array, large iterable.R1 I4 - [Mo13.325μs vs. Mo13.502μs] -1.31% (±1.73%)
    benchCoerce # map, empty array..........R1 I4 - [Mo0.155μs vs. Mo0.788μs] -80.34% (±1.30%)
    benchCoerce # map, empty iterable.......R1 I4 - [Mo0.195μs vs. Mo0.858μs] -77.26% (±1.62%)
    benchCoerce # map, non-empty array......R1 I4 - [Mo0.595μs vs. Mo1.168μs] -49.06% (±0.53%)
    benchCoerce # map, non-empty iterable...R1 I1 - [Mo0.723μs vs. Mo1.572μs] -54.02% (±1.28%)
    benchCoerce # map, large array..........R1 I4 - [Mo10.704μs vs. Mo12.508μs] -14.43% (±1.83%)
    benchCoerce # map, large iterable.......R1 I4 - [Mo14.020μs vs. Mo15.275μs] -8.22% (±0.69%)
    benchAssert # generic array, empty arra.R2 I3 - [Mo0.145μs vs. Mo0.937μs] -84.52% (±1.37%)
    benchAssert # generic array, non-empty .R2 I4 - [Mo0.288μs vs. Mo0.982μs] -70.68% (±2.00%)
    benchAssert # generic array, large arra.R2 I4 - [Mo12.074μs vs. Mo14.671μs] -17.70% (±2.63%)
    benchAssert # int array, empty array....R1 I4 - [Mo0.143μs vs. Mo0.821μs] -82.58% (±2.60%)
    benchAssert # int array, non-empty arra.R1 I4 - [Mo0.465μs vs. Mo1.305μs] -64.37% (±0.53%)
    benchAssert # int array, large array....R1 I4 - [Mo10.921μs vs. Mo12.895μs] -15.31% (±1.99%)
    benchAssert # map, empty array..........R1 I2 - [Mo0.143μs vs. Mo0.840μs] -82.97% (±2.60%)
    benchAssert # map, non-empty array......R1 I2 - [Mo0.570μs vs. Mo1.257μs] -54.65% (±0.78%)
    benchAssert # map, large array..........R5 I4 - [Mo10.356μs vs. Mo10.480μs] -1.19% (±1.89%)
    benchMatch # generic array, empty array.R1 I1 - [Mo0.179μs vs. Mo0.995μs] -81.97% (±2.26%)
    benchMatch # generic array, non-empty a.R1 I4 - [Mo0.317μs vs. Mo1.136μs] -72.07% (±2.11%)
    benchMatch # generic array, large array.R1 I4 - [Mo12.213μs vs. Mo14.747μs] -17.18% (±1.25%)
    benchMatch # int array, empty array.....R2 I4 - [Mo0.175μs vs. Mo0.931μs] -81.21% (±1.42%)
    benchMatch # int array, non-empty array.R1 I2 - [Mo0.486μs vs. Mo1.335μs] -63.62% (±0.82%)
    benchMatch # int array, large array.....R1 I4 - [Mo10.910μs vs. Mo13.128μs] -16.89% (±1.91%)
    benchMatch # map, empty array...........R3 I3 - [Mo0.175μs vs. Mo0.795μs] -77.98% (±1.15%)
    benchMatch # map, non-empty array.......R3 I4 - [Mo0.590μs vs. Mo1.214μs] -51.37% (±0.86%)
    benchMatch # map, large array...........R3 I4 - [Mo10.213μs vs. Mo11.266μs] -9.35% (±0.70%)

\Psl\Tests\Benchmark\Type\NonEmptyStringTypeBench

    benchCoerce # string....................R3 I4 - [Mo0.105μs vs. Mo0.127μs] -17.28% (±1.89%)
    benchCoerce # int.......................R1 I3 - [Mo0.125μs vs. Mo0.150μs] -16.58% (±1.61%)
    benchCoerce # instanceof Stringable (ex.R1 I4 - [Mo0.150μs vs. Mo0.187μs] -19.59% (±3.18%)
    benchCoerce # instanceof Stringable (im.R1 I4 - [Mo0.155μs vs. Mo0.161μs] -3.52% (±1.30%)
    benchAssert.............................R1 I4 - [Mo0.100μs vs. Mo0.125μs] -19.87% (±2.40%)
    benchMatch..............................R1 I4 - [Mo0.105μs vs. Mo0.120μs] -12.50% (±1.89%)

\Psl\Tests\Benchmark\Type\StringTypeBench

    benchCoerce # string....................R1 I0 - [Mo0.095μs vs. Mo0.100μs] -5.18% (±2.63%)
    benchCoerce # int.......................R1 I4 - [Mo0.120μs vs. Mo0.125μs] -4.00% (±1.68%)
    benchCoerce # instanceof Stringable (ex.R1 I4 - [Mo0.143μs vs. Mo0.150μs] -4.76% (±3.19%)
    benchCoerce # instanceof Stringable (im.R1 I4 - [Mo0.135μs vs. Mo0.150μs] -9.89% (±1.79%)
    benchAssert.............................R1 I4 - [Mo0.085μs vs. Mo0.100μs] -14.83% (±2.82%)
    benchMatch..............................R1 I0 - [Mo0.095μs vs. Mo0.100μs] -5.17% (±2.63%)

\Psl\Tests\Benchmark\Type\ArrayKeyTypeBench

    benchCoerce # string....................R2 I2 - [Mo0.095μs vs. Mo0.100μs] -5.00% (±2.08%)
    benchCoerce # int.......................R1 I1 - [Mo0.100μs vs. Mo0.125μs] -19.86% (±2.40%)
    benchCoerce # instanceof Stringable (ex.R1 I0 - [Mo5.975μs vs. Mo5.171μs] +15.53% (±2.07%)
    benchCoerce # instanceof Stringable (im.R1 I0 - [Mo5.867μs vs. Mo4.665μs] +25.78% (±3.67%)
    benchAssert # string....................R1 I3 - [Mo0.095μs vs. Mo0.115μs] -17.42% (±2.63%)
    benchAssert # int.......................R1 I4 - [Mo0.100μs vs. Mo0.125μs] -20.13% (±2.50%)
    benchMatch # string.....................R1 I4 - [Mo0.100μs vs. Mo0.125μs] -19.99% (±1.98%)
    benchMatch # int........................R1 I2 - [Mo0.100μs vs. Mo0.127μs] -21.10% (±2.40%)

\Psl\Tests\Benchmark\Type\IntTypeBench

    benchCoerce # int.......................R5 I4 - [Mo0.095μs vs. Mo0.100μs] -5.32% (±2.63%)
    benchCoerce # string....................R5 I4 - [Mo0.163μs vs. Mo0.205μs] -20.45% (±2.28%)
    benchCoerce # float.....................R5 I4 - [Mo0.120μs vs. Mo0.145μs] -17.34% (±1.68%)
    benchCoerce # instanceof Stringable (ex.R2 I3 - [Mo0.204μs vs. Mo0.255μs] -19.88% (±2.38%)
    benchCoerce # instanceof Stringable (im.R1 I2 - [Mo0.205μs vs. Mo0.209μs] -2.06% (±0.00%)
    benchAssert.............................R1 I4 - [Mo0.085μs vs. Mo0.100μs] -14.83% (±2.82%)
    benchMatch..............................R2 I4 - [Mo0.090μs vs. Mo0.100μs] -9.84% (±2.66%)

\Psl\Tests\Benchmark\Type\ShapeTypeBench

    benchCoerce # empty shape, empty array .R1 I3 - [Mo0.330μs vs. Mo0.358μs] -7.72% (±0.60%)
    benchCoerce # empty shape, empty iterab.R1 I4 - [Mo0.574μs vs. Mo0.620μs] -7.35% (±2.45%)
    benchCoerce # empty shape, non-empty ar.R1 I4 - [Mo0.372μs vs. Mo0.465μs] -19.94% (±1.80%)
    benchCoerce # empty shape, non-empty it.R5 I4 - [Mo0.795μs vs. Mo0.968μs] -17.87% (±2.86%)
    benchCoerce # complex shape with option.R1 I2 - [Mo0.724μs vs. Mo0.862μs] -16.01% (±1.80%)
    benchCoerce # complex shape with option.R1 I3 - [Mo1.801μs vs. Mo4.719μs] -61.83% (±2.59%)
    benchCoerce # complex shape with option.R1 I0 - [Mo0.975μs vs. Mo1.385μs] -29.58% (±2.53%)
    benchCoerce # complex shape with option.R3 I4 - [Mo3.635μs vs. Mo6.848μs] -46.92% (±3.95%)
    benchAssert # empty shape, empty array .R1 I4 - [Mo0.125μs vs. Mo0.151μs] -16.80% (±3.80%)
    benchAssert # empty shape, non-empty ar.R1 I4 - [Mo0.230μs vs. Mo0.280μs] -17.85% (±1.72%)
    benchAssert # complex shape with option.R1 I4 - [Mo1.033μs vs. Mo3.626μs] -71.52% (±0.43%)
    benchAssert # complex shape with option.R1 I0 - [Mo2.090μs vs. Mo5.227μs] -60.01% (±1.37%)
    benchMatch # empty shape, empty array v.R1 I4 - [Mo0.158μs vs. Mo0.196μs] -19.21% (±2.35%)
    benchMatch # empty shape, non-empty arr.R1 I4 - [Mo0.255μs vs. Mo0.310μs] -17.78% (±0.78%)
    benchMatch # complex shape with optiona.R1 I4 - [Mo1.066μs vs. Mo3.678μs] -71.01% (±1.23%)
    benchMatch # complex shape with optiona.R2 I1 - [Mo2.194μs vs. Mo5.185μs] -57.68% (±1.19%)

Subjects: 23, Assertions: 0, Failures: 0, Errors: 0

@veewee veewee marked this pull request as ready for review March 29, 2024 10:10
@veewee veewee requested review from Ocramius and azjezz March 29, 2024 10:10
Copy link
Contributor

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

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

Done an initial skim while on the road: need a laptop to get a full review done

src/Psl/Type/Exception/AssertException.php Outdated Show resolved Hide resolved
src/Psl/Type/Exception/CoercionException.php Outdated Show resolved Hide resolved
src/Psl/Type/Exception/Exception.php Outdated Show resolved Hide resolved
src/Psl/Type/Exception/PathExpression.php Outdated Show resolved Hide resolved
src/Psl/Type/Internal/ConvertedType.php Show resolved Hide resolved
src/Psl/Type/Internal/F32Type.php Show resolved Hide resolved
src/Psl/Type/Internal/F64Type.php Show resolved Hide resolved
src/Psl/Type/Internal/LiteralScalarType.php Show resolved Hide resolved
azjezz
azjezz previously approved these changes Mar 29, 2024
src/Psl/Type/Exception/PathExpression.php Outdated Show resolved Hide resolved
@azjezz azjezz force-pushed the next branch 3 times, most recently from 198e166 to d42f3fa Compare March 30, 2024 04:43
@veewee veewee changed the title [Feat] Traceless types feat(types): Traceless types Mar 30, 2024
Copy link
Owner

@azjezz azjezz left a comment

Choose a reason for hiding this comment

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

LGTM 👍

as for memoizing type objects in functions as mentioned above, I'm okay with it if it brings us a performance boost, otherwise i do not see the need for it.

@Ocramius
Copy link
Contributor

Yeh, can be done later on too, to perhaps do the iteration in a dedicated way.

Copy link
Contributor

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

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

LGTM!

@azjezz WDYT about releasing 3.x with just this breaking change in? It's substantial enough, but allows moving forward easily, IMO :)

@azjezz
Copy link
Owner

azjezz commented Apr 1, 2024

@azjezz WDYT about releasing 3.x with just this breaking change in? It's substantial enough, but allows moving forward easily, IMO :)

For Type\ I'm okay wtih that, but we need to finish #342 and #446 before we can release 3.x ( your review there would be appreciated :) )

@Ocramius
Copy link
Contributor

Ocramius commented Apr 1, 2024

your review there would be appreciated :)

Added to my bucket of things to do tomorrow :)

@veewee
Copy link
Collaborator Author

veewee commented Apr 1, 2024

Allright - looks like this one is ready to ship then.

For Type\ I'm okay wtih that, but we need to finish #342 and #446 before we can release 3.x ( your review there would be appreciated :) )

Lets not rush 3.x. Maybe we can look for other issues / components / things that need these kind of breaking changes first.

As for memoizing type objects in functions as mentioned above, I'm okay with it if it brings us a performance boost, otherwise i do not see the need for it.

I'm planning to play around with the memoizing part soon as well so that I can share some benchmarks there as well. We'll see what gives.

@veewee veewee added Status: Accepted It's clear what the subject of the issue is about, and what the resolution should be. and removed Status: In Progress This issue is being worked on, and has someone assigned. labels Apr 2, 2024
@veewee veewee merged commit f7d74fc into azjezz:next Apr 2, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Medium This issue may be useful, and needs some attention. Status: Accepted It's clear what the subject of the issue is about, and what the resolution should be. Type: BC Break A change that will result in a backward compatibility break in the public API. Type: Enhancement Most issues will probably ask for additions or changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve error messages for shape and vec -like types
4 participants