Commit db3b8a6
committed
Defer formatting task name
The default task name is "Task-<counter>" (if no name is passed in during Task creation).
This is initialized in `Task.__init__` (C impl) using string formatting, which can be quite slow.
Actually using the task name in real world code is not very common, so this is wasted init.
Let's defer this string formatting to the first time the name is read (in `get_name` impl),
so we don't need to pay the string formatting cost if the task name is never read.1 parent dca27a6 commit db3b8a6
1 file changed
+14
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
2065 | 2066 | | |
2066 | 2067 | | |
2067 | 2068 | | |
| 2069 | + | |
2068 | 2070 | | |
2069 | 2071 | | |
2070 | 2072 | | |
2071 | 2073 | | |
2072 | | - | |
2073 | | - | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
2074 | 2079 | | |
2075 | 2080 | | |
2076 | 2081 | | |
| |||
2448 | 2453 | | |
2449 | 2454 | | |
2450 | 2455 | | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
2451 | 2463 | | |
2452 | 2464 | | |
2453 | 2465 | | |
| |||
0 commit comments