Commit f07afea
Performance: decrease runtime overhead for constructing HasTraits (up to 20x faster) (#777)
* perf: find default generators at class contruction time
instead of at runtime, which gives a runtime overhead.
* perf: find descriptors at class construction time
* perf: only add notifiers when they exist
* perf: avoid cross_validation_lock context manager
this has a runtime overhead (about 20% faster without it)
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* perf: get app traits during class construction instead of runtime
* typing
* perf: avoid dynamic default code path for static immutable defaults
* typing
* perf: avoid unnecessary dict presence checks
* more trivial immutable static initial values
* perf: better scaling due to skipping instance_init when possible.
* perf: specialized version of hold_trait_notifications in ctor
* perf: skip setup if no kwargs are given
* fix: validate return value should be used
* flake8: unused variable
* perf: opt out instance_init for bool and enum
* perf: all instances that are None are immutable and static
* perf: remove usage of named attribute accesses on bunches
* trigger ci
* trigger ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Nate Rush <naterush1997@gmail.com>1 parent ee10bcc commit f07afea
2 files changed
Lines changed: 220 additions & 62 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
126 | 129 | | |
127 | 130 | | |
128 | 131 | | |
| |||
2035 | 2038 | | |
2036 | 2039 | | |
2037 | 2040 | | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
2038 | 2058 | | |
2039 | 2059 | | |
2040 | 2060 | | |
| |||
0 commit comments