[HN Gopher] Recording and visualising the 20k system calls it ta...
       ___________________________________________________________________
        
       Recording and visualising the 20k system calls it takes to "import
       seaborn"
        
       Author : sYnfo
       Score  : 58 points
       Date   : 2024-02-16 20:57 UTC (2 hours ago)
        
 (HTM) web link (blog.mattstuchlik.com)
 (TXT) w3m dump (blog.mattstuchlik.com)
        
       | dmwilcox wrote:
       | 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 :)
        
         | axchizhov wrote:
         | 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!
        
           | rising-sky wrote:
           | Ha!
        
           | hnlmorg wrote:
           | 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.
        
           | t8sr wrote:
           | 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.
        
             | 3abiton wrote:
             | 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.
        
         | chx wrote:
         | Forth?? Now, that's a name I haven't heard in a long time. A
         | long time.
        
       | shadycuz wrote:
       | 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
        
       | albertgoeswoof wrote:
       | 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.
        
       ___________________________________________________________________
       (page generated 2024-02-16 23:00 UTC)