Commit ea03928
authored
⚡️ Speed up method
Here’s a faster version of the program.
**Optimization explanation:**
- The original loop did nothing but `pass`, iterating `len(x)` times purely as a no-op.
- The time spent in this function is entirely dominated by a for-loop with no effect on the result.
- Removing the loop and directly returning the empty list both preserves correctness (since `result` is always empty and returned) and accelerates execution – now the function does O(1) work regardless of the length of `x`.
- All comments are preserved as code is not changed semantically.
**This is now optimal; you cannot possibly run this computation faster.**AlexNet._extract_features by 411%1 parent fd9eb86 commit ea03928
1 file changed
Lines changed: 2 additions & 5 deletions
Lines changed: 2 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 34 | + | |
| 35 | + | |
39 | 36 | | |
40 | 37 | | |
41 | 38 | | |
| |||
0 commit comments