Skip to content

ClassBuilder: eval only once #1407

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 22 commits into from
Feb 15, 2025
Merged

ClassBuilder: eval only once #1407

merged 22 commits into from
Feb 15, 2025

Conversation

Tinche
Copy link
Member

@Tinche Tinche commented Feb 9, 2025

No description provided.

@Tinche Tinche force-pushed the tin/speed-up-eval branch from 8e5debe to d473ae9 Compare February 9, 2025 20:33
@Tinche Tinche changed the title docs: stress that make_class doesn't validate names ClassBuilder: eval only once Feb 9, 2025
@Tinche Tinche force-pushed the tin/speed-up-eval branch 2 times, most recently from 33e139d to 2960493 Compare February 9, 2025 20:41
Copy link

codspeed-hq bot commented Feb 9, 2025

CodSpeed Performance Report

Merging #1407 will improve performances by 52.27%

Comparing tin/speed-up-eval (f799f56) with main (e048efc)

Summary

⚡ 3 improvements
✅ 5 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
test_create_frozen_class 1.8 s 1.3 s +38.49%
test_create_simple_class 1.5 s 1 s +46.66%
test_create_simple_class_make_class 1,496.7 ms 982.9 ms +52.27%

@Tinche Tinche force-pushed the tin/speed-up-eval branch 2 times, most recently from c9c5635 to 993e6f8 Compare February 10, 2025 09:15
@Tinche
Copy link
Member Author

Tinche commented Feb 10, 2025

I added type hints to some internal functions. This was to make dev easier for me, not to type-check formally.

@Tinche Tinche requested a review from hynek February 11, 2025 00:04
@hynek
Copy link
Member

hynek commented Feb 11, 2025

I added type hints to some internal functions. This was to make dev easier for me, not to type-check formally.

do you think it would be a lot of work to make the code base pass in lenient mode? I.e. if there's hints, they must not contradict otherwise YOLO?

@Tinche
Copy link
Member Author

Tinche commented Feb 12, 2025

do you think it would be a lot of work to make the code base pass in lenient mode? I.e. if there's hints, they must not contradict otherwise YOLO?

Not sure, but it might be worth it. Should be a different PR of course.

Copy link
Member

@hynek hynek left a comment

Choose a reason for hiding this comment

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

News fragment please, then I think this is good to go.

@Tinche
Copy link
Member Author

Tinche commented Feb 15, 2025

News fragment please, then I think this is good to go.

Done!

Copy link
Member

@hynek hynek left a comment

Choose a reason for hiding this comment

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

vroom, fucking, vroom

@hynek hynek added this pull request to the merge queue Feb 15, 2025
Merged via the queue into main with commit 74007f6 Feb 15, 2025
19 checks passed
@hynek hynek deleted the tin/speed-up-eval branch February 15, 2025 12:00
luketainton pushed a commit to luketainton/pypilot that referenced this pull request Mar 12, 2025
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [attrs](https://github.com/python-attrs/attrs) ([changelog](https://www.attrs.org/en/stable/changelog.html)) | project.dependencies | minor | `==25.1.0` -> `==25.2.0` |

---

### Release Notes

<details>
<summary>python-attrs/attrs (attrs)</summary>

### [`v25.2.0`](https://github.com/python-attrs/attrs/blob/HEAD/CHANGELOG.md#2520---2025-03-12)

[Compare Source](python-attrs/attrs@25.1.0...25.2.0)

##### Changes

-   Checking mandatory vs non-mandatory attribute order is now performed after the field transformer, since the field transformer may change attributes and/or their order.
    [#&#8203;1147](python-attrs/attrs#1147)
-   `attrs.make_class()` now allows for Unicode class names.
    [#&#8203;1406](python-attrs/attrs#1406)
-   Speed up class creation by 30%-50% by compiling methods only once and using a variety of other techniques.
    [#&#8203;1407](python-attrs/attrs#1407)
-   The error message if an attribute has both an annotation and a type argument will now disclose *what* attribute seems to be the problem.
    [#&#8203;1410](python-attrs/attrs#1410)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xOTYuMCIsInVwZGF0ZWRJblZlciI6IjM5LjE5Ni4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.tainton.uk/repos/pypilot/pulls/316
Reviewed-by: Luke Tainton <[email protected]>
Co-authored-by: Renovate [BOT] <[email protected]>
Co-committed-by: Renovate [BOT] <[email protected]>
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.

2 participants