Live data from Hacker News

Recording and visualising the 20k system calls it takes to "import seaborn"

blog.mattstuchlik.com

1–10 of 56 posts

Re: Recording and visualising the 20k system calls it takes to "import seaborn"

#2
I've been writing python for going on 20 years now and while it was a good language to cut my teeth on thus sort of analysis brings only horror. Many thanks to the author for dropping into plain view.

I'm going to go back to learning more C and Forth... And shake my fist at passing clouds :)

Re: Recording and visualising the 20k system calls it takes to "import seaborn"

#3
I also wrote a somewhat similar tool. I call it deep-ast. It's pretty flexible in what it can track. I used it when refactoring some code in urllib3, to see what Exceptions could get raised along a given code path.

https://github.com/DontShaveTheYak/deep-ast

Re: Recording and visualising the 20k system calls it takes to "import seaborn"

#4
post #2

I've been writing python for going on 20 years now and while it was a good language to cut my teeth on thus sort of analysis brings only horror. Many thanks to the author for dropping into plain view. I'm going to go back to learning more C and Forth... And shake my fist at passing clouds :)

So, instead of printing a pretty plot in 2 lines of code, you will be... making these 20k syscalls yourself?

You have such unusual hobby, my friend!

Re: Recording and visualising the 20k system calls it takes to "import seaborn"

#5
post #2

I've been writing python for going on 20 years now and while it was a good language to cut my teeth on thus sort of analysis brings only horror. Many thanks to the author for dropping into plain view. I'm going to go back to learning more C and Forth... And shake my fist at passing clouds :)

So, instead of printing a pretty plot in 2 lines of code, you will be... making these 20k syscalls yourself? You have such unusual hobby, my friend!

Ha!

Re: Recording and visualising the 20k system calls it takes to "import seaborn"

#6
post #2

I've been writing python for going on 20 years now and while it was a good language to cut my teeth on thus sort of analysis brings only horror. Many thanks to the author for dropping into plain view. I'm going to go back to learning more C and Forth... And shake my fist at passing clouds :)

Forth?? Now, that's a name I haven't heard in a long time. A long time.

Re: Recording and visualising the 20k system calls it takes to "import seaborn"

#7
post #2

I've been writing python for going on 20 years now and while it was a good language to cut my teeth on thus sort of analysis brings only horror. Many thanks to the author for dropping into plain view. I'm going to go back to learning more C and Forth... And shake my fist at passing clouds :)

So, instead of printing a pretty plot in 2 lines of code, you will be... making these 20k syscalls yourself? You have such unusual hobby, my friend!

Python will do a lot under the hood that a hand-rolled C solution wouldn’t. So I wouldn’t expect the C equivalent to make the same number of syscalls as Python.

Re: Recording and visualising the 20k system calls it takes to "import seaborn"

#8
post #2

I've been writing python for going on 20 years now and while it was a good language to cut my teeth on thus sort of analysis brings only horror. Many thanks to the author for dropping into plain view. I'm going to go back to learning more C and Forth... And shake my fist at passing clouds :)

So, instead of printing a pretty plot in 2 lines of code, you will be... making these 20k syscalls yourself? You have such unusual hobby, my friend!

It doesn’t take 20k syscalls to print a plot, the 20k syscalls is for the import call. I would hope that drawing plots takes a lot less.

To engage with your point: loading a dynamic library in a regular language takes significantly less than 20k syscalls. Probably 20-40 for C on Linux. Python is uniquely inefficient. On most plots comparing resource use by different languages, in order to even show python together with regular languages like Java and C, either you use the log scale, or everything but Python is shown as a single point.

Of course, most people use Python to glue together stuff written in C, so it’s not that big of a deal, but it becomes a problem when people forget pure Python code is literally hundreds or thousands times slower than a “regular” program doing the same thing.

Re: Recording and visualising the 20k system calls it takes to "import seaborn"

#9
Today I asked a devops engineer to tell me how much time a long (3 seconds avg) api call was spending on database queries, application logic, and network etc. He couldn’t understand the request and instead opened up the azure console and recommended we increase the number cpu cores / memory if performance is an issue.

I look at posts like this and cry.

Re: Recording and visualising the 20k system calls it takes to "import seaborn"

#10
post #8

Earlier quoted context omitted.

So, instead of printing a pretty plot in 2 lines of code, you will be... making these 20k syscalls yourself? You have such unusual hobby, my friend!

It doesn’t take 20k syscalls to print a plot, the 20k syscalls is for the import call. I would hope that drawing plots takes a lot less. To engage with your point: loading a dynamic library in a regular language takes significantly less than 20k syscalls. Probably 20-40 for C on Linux. Python is uniquely inefficient. On most plots comparing resource use by different languages, in order to even show python together wi…

Modularity and customization come at a cost. Python is the systemd of computer languages. But it is not trying to sell itself under the KISS banner.
Post reply on HN