News for hackers. Stuff that matters.

Ask HN: Help finding python profiling article

Hi I remember reading a blog post someone posted here a year or two ago, about someone profiling his python code and rewriting it to be a lot faster. It had a lot of details of what was done and the reasoning behind it. Does anyone happen to know what it was?
( 6 comments | 6 points | on HN )
Re:Ask HN: Help finding python profiling article by a3n on Thursday June 12, 2014 @05:33PM (#7886086)
Maybe this? http://pymotw.com/2/profile/

From here: https://hn.algolia.com/?q=python+profile#!/story/forever/0/p...

I use pinboard to bookmark anything that I think has the slightest chance that I'll want to see it again. Most of the time I never look at a bookmark again, because you usually don't know what you'll need in the future. But I've found enough things like what you're looking for (but not this time obviously) that the practice has become worthwhile.

https://pinboard.in/

Re:Ask HN: Help finding python profiling article by DanBC on Thursday June 12, 2014 @05:36PM (#7886107)
Re:Ask HN: Help finding python profiling article by mrfusion on Friday June 13, 2014 @08:26AM (#7888425)
I usually turn garbage collection off, and then explicitly call it just in places where I need to free up memory. I get a modest 5-10% speed boost from that alone.

Another trick is to look at your innermost loops, and make sure you aren't doing accessing anything fancier than a variable.

Example

Bad:

for i in onemillionthings: for j in onemillionotherthings: print SomeClass.otherthing.A

Better: tempvar=SomeClass.otherthing.A for i in onemillionthings: for j in onemillionotherthings: print tempvar

Re:Ask HN: Help finding python profiling article by pyeek on Friday June 13, 2014 @02:17PM (#7890154)
It isn't the ones listed so far. I vaguely remember it talking about choices like loops, comprehensions, data types etc. and eventually his code became about 8-10 times faster.

I will continue to search and will post back here once I find it. Thanks for everyone's help.

Re:Ask HN: Help finding python profiling article by ianamartin on Thursday June 12, 2014 @05:26PM (#7886056)
python profiling site:news.ycombinator.com

???

Re:Ask HN: Help finding python profiling article by pyeek on Friday June 13, 2014 @02:14PM (#7890146)
that's the search I used, but couldn't find it