Hacker Newsnew | past | comments | ask | show | jobs | submit | more BiteCode_dev's commentslogin

5bpm is earth shattering for longevity and general health.


Still better than what happens in the US.


QT talent pool and ecosystem is a rounding error compared to what we have with the web ecosystem. If you want to make something with medias, graphs, a few custom widgets, a reactive layout and deep routing, it will take 10 to 30 times longer with QT.

I myself prefer the snapiness of QT apps, but budget and time to market will win.


Electron apps are always resource hogs, frequently slow and generally integrate extremely poorly. As a consumer I care not one whit for how large the "talent pool" for the web ecosystem is, I care about how terrible the application is.

As a developer I must say calling it talent is in most cases a huge stretch, as I do believe you can probably make something in Electron that performs passably, integrates passably and will still be a resource hog. The reason we see basically none of this is because people simply don't care to engineer these applications well. "It's just the browser", after all. Why look deeper?


Sure but most teams do the maths for the cost/benefit ratio and make the call.

In this context the argument is moot: a better app that is too expensive or slow to make is simply not going to be released vs the worse one that actually gets published.

That's all there is to it.

That's why people still use wordpress, excel or jupyter notebooks for important stuff.

You may want things to be different, and for good reasons, but it's still what's the market has decided.


What does "deep routing" mean?


Views, sub views, partial views and complex hierachic workflows. Url base routers are great for those, but QT controllers let you reinvent the wheel.


I assume either deep nesting or deeplinks.


    ...
    I'm adding A1 and the 7C
    Everybody's looking to SUM() things


Well yes, the Goodwin point is now crossed very casually, just like people are using superlatives for the mundane things, such as "I ate the most amazing fries yesterday".

This makes for poor debates, where there is little nuance, fuzzy scales and hardly meaningful communication.


They were also drinking water every day.

That doesn't make water bad.

I wish for people to be strong, just like I wish them good health, because it's a quality that makes for a happier life.

If one has the strength of character not to be pressured to do bad things, you get less fascists, not more.


I think you are the one infected with a very paternalistic vision of strength.

Strength is the ability to apply force, it's the quality of solidity, the potential for resistance, etc.

E.G: it takes strength to not act on fear and hate. Gandhi is considered a man of great strength.


There are plenty of things for which python is not slow, but people using python don't know a lot about programming, and end up with a slow result.

A couple of advises:

- the right algo will go a long, long way.

- know your data structures. E.G: assigning to a slice is ridiculously fast (even while unpacking), memory views may save a lot on byte heavy workloads, heapq and deque are underrated, etc. Also check out https://wiki.python.org/moin/TimeComplexity for big O notations on python builtin types common operations to understand what you pay for.

- know the stdlib. collections, itertools and functools all contain incredible gems.

- delegate. Python is a fantastic glue language, use it for what it's good at. Your database, your numpy arrays, your cache are all amazing are what they do, no matter the language. Let them do the heavy work.

- don't kill good perfs by ignorance. I regularly see people casting a generator, iterating on a dataframe, calling readlines() on a file or doing something else that is destroying the otherwise excellent perfs of their program.

- know the ecosystem. There are some very good fast libs out there: diskcache, sortedcontainer, scipy, uvloop...

- use threads to avoid blocking a GUI, multiprocess to share work between CPU and asyncio to speed up network operations. Each tool has a sweet spot. But threads are underrated, they work well for a couple of hundred parallel network operations, and most C libs will actually release the GIL, so they can use several CPU more often than you'd thin. Also, use pools if you can, shared_memory in 3.8 or mmap.

- sometime the dirty solution is just faster, like subprocessing to ffmpeg.

- The more recent, the slower. Sure, I love statistics, pathlib and dataclasses. In a regular code they are great. On a bottleneck however, they are very slow.

- the array module is not supposed to speed up the code, only save memory. But sometimes it does.

- printing to the terminal is limiting. Sometime your program is doing fine, the display is preventing it to go faster. At least check the flush.

- comprehensions are faster than alternatives.

- pre-allocating lists and dicts can help.

- measure. The austin profiler is your friend.

- rewriting the hot path in a faster language is likely more interesting than writing the whole program in it. A bit of nim or rust is easy to call from python.

- some python distribution are faster than others. I don't mean just pypy, but also regular cpyhon that have been built specially for some architectures. E.G: https://www.intel.com/content/www/us/en/developer/tools/onea...

- nuitka code compilation can speed up the code by a factor of 4, it's nice, especially for startup.


A big thank you! This is an amazing list of things to look into and keep in mind. Many points are obscure to me, but I'm going to print this and keep it at hand. Thanks again.


>pathlib and dataclasses. In a regular code they are great. On a bottleneck however, they are very slow.

Do you have any numbers to back this up? Why would Pathlib be slow?


Anthony Sottile has a good bit on it: https://www.youtube.com/watch?v=tFrh9hKMS6Y

TL;DR: Path() initialization is very heavy compared to simple strings, and subsequent path operations produce new Path() objects every time.

The video then illustrates the point with a patch to the black formatter cache yielding a 40X speedup.


Oh, that is unfortunate. Thanks for the tip.


How do you pre-allocate lists and dicts?


l = [None] * size


If you compile Python, you may also try nuitka, which can not only compile a standalone program, but also compile a single package.


Anybody very successful has had a lot of luck, that's a given.

But since it's about science, and revolutioning it on too of that, claiming there was nothing special about Einstein make little sense.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: