Commit a162f0d
authored
⚡️ Speed up method
Here's an optimized rewrite of your program. Since the body of the for-loop is `pass` (it does nothing), the entire loop can be removed for maximum speed, and thus, the function can return an empty list immediately. This returns the exact same result as before, but with negligible runtime.
This is now optimal: zero iterations, zero memory allocations inside a loop, and instantly returns. If later you add content inside the loop, further optimizations may be possible depending on the new code.AlexNet._extract_features by 978%1 parent 2d811db commit a162f0d
1 file changed
Lines changed: 3 additions & 5 deletions
Lines changed: 3 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
| |||
0 commit comments