Python is slow for Desktop based App?

Python is a single-threaded language. Will this make the Desktop-based app slower because parallel operations are not executing? I went through some articles. This notion is quite popular among developers.

Depends entirely on the workload.

For a very simple program with little to no I/O and little to no hard calculations you won’t know whether an application is single threaded or multi threaded.

Multi threaded only brings something to the table for programs with loads of I/O and/or hard calculations (that can be distributed, not all hard calculations can be!).

2 Likes

Thanks @rpkamp
JS is also single-threaded. It is AJAX that makes it a multitasker. Does Python also have something of similar potential?

You are mixing up two things.

python is running on Server side, while Ajax (JavaScript) is running on client site.

So the client can start multiple python scripts but one script is always running single threaded.

1 Like

I think node and ajax do work together.

AJAX has nothing to do with multi-threading in JS. It is emulated using job queues. Your async code in JS only works when sync call stack is empty.

1 Like

Nope. Still single threaded, it just behaves like it’s multithreaded due to intelligent scheduling.

Before we delve into the internals of all sorts of languages, what are you trying to achieve?

3 Likes

Thanks for replying @rpkamp

OK. As you said intelligent scheduling, must be optimizing available resources and give an illusion of multitasking.

I just started learning Python with dedication, and someone on tech Twitter triggered this warning that Python may not be for deploying scaled apps as it slows down due to single threading. I was losing my prudence and was feeling demotivated.

Every programming language has upsides and downsides. There is no perfect language. If there was, there was no more reason for all other languages to exist …

If somebody points out a downside to a language, just accept that as being a downside of the language and then consider if what you want to do with the language still makes sense.

Also, Twitter is a very bad source for tech information, there is an extreme lack of nuance on Twitter.

A bit of general advice:

  1. Whenever you read something, don’t accept it without considering what it means first. Try to integrate it with your current knowledge and make adjustments where needed.
  2. It’s okay to make mistakes. It’s fine to first think using Python is a good idea and then abandon it later, given enough evidence against that choice
  3. Try to avoid tying your ego to the decisions you make (ie. I made this decision, not I am this decision). This makes point 2 hard(er).
5 Likes

You can couple Python with desktop UI libraries like Qt or GTK, which are written in C/C++ and have asynchronous event loop architecture similar to one in JS. For heavy tasks you can spawn as many background python workers as you want using subprocess module. I don’t see how single-threading may affect something here.

I would personally use JS+Electron to make a cross-platform desktop app today. But I believe that Python+QT/GTK would work faster than Electron. The other side is the Python itself. It wasn’t designed with GUI in mind, so your app code may look not so elegant.

1 Like

Sublime text is designed in Python, and it has a good GUI.

Atom code editor boots every slowly as compared to sublime.

Alright.

Thanks for that insight.

You are always insightful. thank you so much for giving a critical perspective.

How about VS Code? :grinning:

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.