9 votes

Making Python Programs Blazingly Fast

7 comments

  1. anahata
    Link
    These points seem to contradict one another. The author suggests that the language code is written in will have less impact than the code itself, and then their first suggestion for making things...

    Well, whether specific program - regardless of programming language used - is fast or slow is very much dependant on developer who wrote it and their skill and ability to write optimized and fast programs.

    That's mainly because the built-ins are implemented in C, which we can't really match in speed when coding in Python.

    These points seem to contradict one another. The author suggests that the language code is written in will have less impact than the code itself, and then their first suggestion for making things faster... is to use something implemented in another language. Kind of defeats their point, IMO.

    I also would have appreciated (and, frankly, am surprised there isn't) a before-and-after comparison of the unoptimized vs optimized programs. This makes it harder to judge the impact of the suggested changes, and puts the onus on the user to test each individual suggestion to see how they impact performance.

    7 votes
  2. [6]
    HanakoIsBestGirl
    Link
    This is offtopic. I assume that this website is a blog (given the URL). Probably text and some images. Why does it require JavaScript? JavaScript for little extras, sure. But not to view text.

    We're sorry but frontend doesn't work properly without JavaScript enabled. Please enable it to continue.

    This is offtopic. I assume that this website is a blog (given the URL). Probably text and some images. Why does it require JavaScript? JavaScript for little extras, sure. But not to view text.

    5 votes
    1. [5]
      Adys
      Link Parent
      Because the guy chose to write his personal blog in javascript and didn't bother setting up server-side rendering (which costs extra). It's a personal blog, not a corporate website. Let's not...

      Because the guy chose to write his personal blog in javascript and didn't bother setting up server-side rendering (which costs extra).

      It's a personal blog, not a corporate website. Let's not chastise people for not catering to the 0.0001%.

      3 votes
      1. [4]
        anahata
        (edited )
        Link Parent
        Part of it is not catering to those who have JS off, but part of it is also a legitimate technical criticism: a blog doesn't need JS. Why require it? This is developer-centric design rather than...

        Part of it is not catering to those who have JS off, but part of it is also a legitimate technical criticism: a blog doesn't need JS. Why require it? This is developer-centric design rather than user-centric design, which lacks empathy for the user. Software should be designed for the user experience, not the developer experience.

        edit: word choice

        2 votes
        1. [3]
          Adys
          Link Parent
          He's not requiring it, that makes it sound like he is explicitly, with intent, wanting people to have js in order to view his blog. This is never the case. He just chose to write his blog in...

          He's not requiring it, that makes it sound like he is explicitly, with intent, wanting people to have js in order to view his blog. This is never the case.

          He just chose to write his blog in JavaScript. Kinda like one might choose to write it in Ruby or python or countless more. But the difference is by writing it in JavaScript and running it clientside rather than serverside, well, the client needs js.

          This isn't uncommon because it's a good dev environment, it's highly sought after m, and it is quite fun to work with. I've done fifteen years of python and I can tell you, typescript and react are amazing to work with. But by choosing to go the JS app route, client only app, well you do require JavaScript to be enabled.

          1 vote
          1. [2]
            anahata
            Link Parent
            I don’t understand this comment. You say that the author doesn’t require JS, but then you say that, because of how the site is written, it requires JS. This is the same kind of contradictory...

            I don’t understand this comment. You say that the author doesn’t require JS, but then you say that, because of how the site is written, it requires JS. This is the same kind of contradictory point, the same kind of fallacious logic, I was trying to illustrate in critique of the content of the site.

            Am I misunderstanding something?

            1. Adys
              Link Parent
              I didn't word it very well, yeah. Let's start at the beginning. If you want to host your own blog, you can either go with a prebuilt solution such as Wordpress, Medium or Ghost, or you can write...

              I didn't word it very well, yeah.

              Let's start at the beginning. If you want to host your own blog, you can either go with a prebuilt solution such as Wordpress, Medium or Ghost, or you can write your own.

              If you write your own blog, you're developing and hosting your own site. By doing that, you have to make a few informed choices such as:

              1. What tools you know or wish to learn / try your hand at, with which you could build the site
              2. How much time you want to invest in writing your site
              3. How much money you want to invest in the hosting infrastructure

              Now consider the following:

              1. JavaScript is a skill a lot of programmers either know or wish to learn, as it's in very high demand
              2. Writing blogs in JavaScript is often very quick as there are incredibly good tools and frameworks to do exactly that
              3. Keeping the JavaScript client-side only makes the site far cheaper to host, thanks to free or near-free CDNs such as Cloudflare, and hosted static sites such as github pages.

              And on top of all this, remember that virtually everybody on the web has access to javascript. Now maybe you start to see why the solution the author of this blog employed is starting to make sense.

              There are other solutions, but the author didn't end up choosing them. Not because he wanted to exclude you, and specifically wanted to require JS to "display text", as you say, but rather because it was easier this way.

              Seeing as it is a personal blog, I don't really think it's appropriate to really complain about it.

              2 votes