frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Smart Performance Hacks for Faster Python Code

https://blog.jetbrains.com/pycharm/2025/11/10-smart-performance-hacks-for-faster-python-code/
32•ashvardanian•1w ago

Comments

tyingq•1h ago
Maybe also knowing when not to use python, or finding a solution in python that uses C/rust/etc underneath.
woodruffw•1h ago
(2) surprised me a little. Not because of the performance consequences, but because I almost never see explicit calls to `copy()` in Python (and I read a lot of Python).

I think maybe a more realistic example there would be people using splatting without realizing/internalizing that it performs a full copy, e.g.

    xs = [1, *ys] 
Another one that stood out was (3). Slots are great, but >95% of the time I'd expect people would want to use `slots=True` with dataclasses instead of manually writing `__slots__` and a constructor like that. `slots=True` has worked since Python 3.10, so every non-EOL version of Python supports it.
sgarland•38m ago
You can use __slots__ for normal classes; it’s not limited to only dataclasses.
woodruffw•34m ago
I know that; that's why I said "I'd expect" not "you can't."
automatoney•32m ago
There's some genuinely interesting tips in here, but #10 is for sure just padding so they could call the article "10 Hacks" haha. Everything else is at least somewhat Python specific, but "Hack 10: Avoid repeated function calls in loops" is just applicable to anything.
persedes•31m ago
Some helpful guidelines, but it's 2025 and people still use time.time and no stats with their benchmarks :(

In general I feel like these kind of benchmarks might change for each python version, so some caveats might apply.

LigmaBaulls•25m ago
a smart hack for performance is don't use python
pansa2•16m ago
> Copying large objects like lists […] can be costly in both time and memory.

> modify[ing] objects in place […] improves performance by avoiding the overhead of allocating and populating new structures.

AFAIK the poor performance of list copies (demonstrated in the article by a million-element list taking 10ms) doesn’t come from memory allocation nor from copying the contents of the list itself (in this case, a million pointers).

Rather it comes from the need to chase all of those pointers, accessing a million disparate memory locations, in order to increment each element’s reference count.

Nano Banana Pro

https://blog.google/technology/ai/nano-banana-pro/
175•meetpateltech•1h ago•107 comments

Red Alert 2 in web browser

https://chronodivide.com/
165•nsoonhui•3h ago•53 comments

Interactive World History Atlas Since 3000 BC

http://geacron.com/home-en/
185•not_knuth•6h ago•89 comments

Judgement on Dr Matthew Garrett (@mjg59) vs. Dr Roy Schestowitz (Techrights.org)

https://caselaw.nationalarchives.gov.uk/ewhc/kb/2025/3063
50•jonty•2h ago•19 comments

Firefox 147 Will Support the XDG Base Directory Specification

https://www.phoronix.com/news/Firefox-147-XDG-Base-Directory
117•bradrn•1h ago•39 comments

Adversarial Poetry as a Universal Single-Turn Jailbreak Mechanism in LLMs

https://arxiv.org/abs/2511.15304
119•capgre•4h ago•73 comments

40 years ago, Calvin and Hobbes' burst onto the page

https://www.npr.org/2025/11/18/nx-s1-5564064/calvin-and-hobbes-bill-watterson-40-years-comic-stri...
202•mooreds•4h ago•66 comments

Android/Linux Dual Boot

https://wiki.postmarketos.org/wiki/Dual_Booting/WiP
202•joooscha•3d ago•110 comments

CUDA Ontology

https://jamesakl.com/posts/cuda-ontology/
182•gugagore•3d ago•27 comments

Basalt Woven Textile

https://materialdistrict.com/material/basalt-woven-textile/
163•rbanffy•10h ago•86 comments

Europe is scaling back GDPR and relaxing AI laws

https://www.theverge.com/news/823750/european-union-ai-act-gdpr-changes
861•ksec•1d ago•984 comments

Towards Interplanetary QUIC Traffic

https://ochagavia.nl/blog/towards-interplanetary-quic-traffic/
65•wofo•2d ago•14 comments

Smart Performance Hacks for Faster Python Code

https://blog.jetbrains.com/pycharm/2025/11/10-smart-performance-hacks-for-faster-python-code/
32•ashvardanian•1w ago•8 comments

Theft of the Weeping Woman from the National Gallery of Victoria

https://en.wikipedia.org/wiki/Theft_of_The_Weeping_Woman_from_the_National_Gallery_of_Victoria
7•neom•5d ago•2 comments

Meta Segment Anything Model 3

https://ai.meta.com/sam3/
593•lukeinator42•22h ago•118 comments

Scientists Reveal How the Maya Predicted Eclipses for Centuries

https://www.sciencealert.com/scientists-reveal-how-the-maya-predicted-eclipses-for-centuries
47•rguiscard•6d ago•11 comments

Loose wire leads to blackout, contact with Francis Scott Key bridge

https://www.ntsb.gov:443/news/press-releases/Pages/NR20251118.aspx
395•DamnInteresting•19h ago•184 comments

The lost cause of the Lisp machines

https://www.tfeb.org/fragments/2025/11/18/the-lost-cause-of-the-lisp-machines/
115•enbywithunix•20h ago•115 comments

DOS Days – Laptop Displays

https://www.dosdays.co.uk/topics/laptop_displays.php
44•nullbyte808•7h ago•9 comments

Researchers discover security vulnerability in WhatsApp

https://www.univie.ac.at/en/news/detail/forscherinnen-entdecken-grosse-sicherheitsluecke-in-whatsapp
282•KingNoLimit•19h ago•110 comments

Verifying your Matrix devices is becoming mandatory

https://element.io/blog/verifying-your-devices-is-becoming-mandatory-2/
165•LorenDB•15h ago•186 comments

New Proofs Probe Soap-Film Singularities

https://www.quantamagazine.org/new-proofs-probe-soap-film-singularities-20251112/
30•pseudolus•1w ago•3 comments

Wrapping my head around AI wrappers

https://www.wreflection.com/p/wrapping-my-head-around-ai-wrappers
25•nowflux•4d ago•15 comments

Building more with GPT-5.1-Codex-Max

https://openai.com/index/gpt-5-1-codex-max/
455•hansonw•22h ago•280 comments

A surprise with how '#!' handles its program argument in practice

https://utcc.utoronto.ca/~cks/space/blog/unix/ShebangRelativePathSurprise
86•SeenNotHeard•1d ago•72 comments

Precise geolocation via Wi-Fi Positioning System

https://www.amoses.dev/blog/wifi-location/
221•nicosalm•18h ago•87 comments

Details about the shebang/hash-bang mechanism on various Unix flavours (2001)

https://www.in-ulm.de/%7Emascheck/various/shebang/
63•js2•11h ago•13 comments

How Slide Rules Work

https://amenzwa.github.io/stem/ComputingHistory/HowSlideRulesWork/
162•ColinWright•19h ago•46 comments

Launch HN: Mosaic (YC W25) – Agentic Video Editing

https://mosaic.so
132•adishj•1d ago•123 comments

210 IQ Is Not Enough

https://taylor.town/iq-not-enough
124•surprisetalk•1h ago•150 comments