bluesky / suitcase-tiff

http://nsls-ii.github.io/suitcase
Other
3 stars 6 forks source link

PERF: Call asarray once and stash the result in a local. #14

Closed danielballan closed 5 years ago

danielballan commented 5 years ago

Performance optimization on #13 --- If numpy.asarray is making a copy (e.g. from a Python list object) it would be faster to do it once.

awalter-bnl commented 5 years ago

@mrakitin the reason for not using the alias is that I don't like alias's !-)

mrakitin commented 5 years ago

OK, either way is fine, but I intuitively typed np.asarray() twice yesterday and got the error. I guess future contributors can meet the same situation.

danielballan commented 5 years ago

Gil Forsyth persuaded me at scipy that this doesn't add much value. For numpy, pandas, and matplotlib "everybody knows" the common abbreviations, but for many other libraries there is no widely-adopted standard. He argues that there isn't much gained by abbreviating just a handful of the modules and not others, and in a world where we have tab-complete, the clarity of spelling it out should win.

So I've started spelling things out, myself. I don't feel strongly enough about it that I would leave a review comment asking someone not to use np.

mrakitin commented 5 years ago

OK, sounds as a reasonable usage.