Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
min-cut
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
4 ms
·
1.
▲
by
min-cut
5y ago
I see about a 10% performance improvement on my local machine on the input in test.py when not constructing the unnecessary second list. I don't really buy that it reads nicer in prose since you can just do (a + b).sort() if you want.
2.
▲
by
min-cut
5y ago
Not only that, but also list(a + b) is producing two different new lists since (a + b) produces a list and list() constructs a new list copy. The benchmark would be faster if the OP just did def sort_test(): m2 = a + b; m2.sort() inst