Alex Gaynor: Fast Python, Slow Python - PyCon 2014

  Рет қаралды 62,457

PyCon 2014

PyCon 2014

Күн бұрын

Speaker: Alex Gaynor
"The common wisdom is that Python is slow. And yet people run high performance software on it. It's hard to make Python fast, and yet there are incredibly high performance Python VMs. This talk breaks down the facts and the myths of Python performance."
Slides can be found at: speakerdeck.com/pycon2014 and github.com/PyCon/2014-slides

Пікірлер: 42
@JimmyGunawanX
@JimmyGunawanX 7 жыл бұрын
Skip to 1:34 to really start.
@abyssalplanes
@abyssalplanes 2 жыл бұрын
and skip that sick beat? no way!
@mtaur4113
@mtaur4113 4 жыл бұрын
I feel like this was a lot of high-level choir preaching and sermonizing and not a whole lot of practical instruction on how to program better.
@paroxyzm21
@paroxyzm21 9 жыл бұрын
Great talk! Can somebody point me to the place where I can learn more about Dicts vc Objects memory performance? It realy surprised me to hear thar dicts can use more memory than objects... just like the man who asked a question around 33:40
@tizbr
@tizbr 9 жыл бұрын
he is really excellent at handling questions
@spoolboyy
@spoolboyy 8 жыл бұрын
This was a very interesting talk. And although I enjoyed the song, I could have done without the 90 seconds of music at the beginning though. Anybody else wondering if the video editor is the lead guitarist of Gramatik?
@younglife88
@younglife88 7 жыл бұрын
Liked the talk, Speaker answers questions like if he was reading the answers haha
@eqapo
@eqapo 7 жыл бұрын
it would have been better to make the connection between pythonic/idiomatic code and specialized code. Either that they are the same, or that specialized code is a subset of pythonic code
@grawss
@grawss Жыл бұрын
Has this changed since this talk? Dicts now use hashmaps, so a dict with a few million entries is no different from a dict with a couple. With slots it might be faster because it avoids the dict within the class (pretty sure? I'm still a rookie), but what's the difference really? Either way we're still looking into globals, then the class key/dict key, then the value. Unless I'm missing something. TBH I just don't want a ton of extra code and classes and scopes when a dict is just like.. whatever you want. Plus I do a lot of text parsing, and respond a lot to text-input, so a dict lookup is way faster in this case. {'key': var} is a hashed lookup with no other conversion, whereas classes would require attribute lookups.
@MarkJay
@MarkJay 7 жыл бұрын
interesting talk! need to pypy
@teodordima3639
@teodordima3639 10 жыл бұрын
Is the third asker Steve Yegge? Seems like his voice.
@thomasgandalf4111
@thomasgandalf4111 8 жыл бұрын
some of these examples are definetly not pythonic (e.f. adding booleans to count 4 arguments -- don't do that
@Xavier-es4gi
@Xavier-es4gi 3 жыл бұрын
I'm a bit late but can you explain why and what alternative would be good
@AnkushJindaljindalankush95
@AnkushJindaljindalankush95 9 жыл бұрын
Can someone point to the link of wiki page mentioned by Alex at 32:45 ?
@tizbr
@tizbr 9 жыл бұрын
+Ankush Jindal wiki.python.org/moin/TimeComplexity
@typedeaf
@typedeaf 9 жыл бұрын
I am entirely new to Python, but from what I understand, classes are implemented using a dict. For instance .__dict__ will show all of the objects attributes in their internal dictionary form. So, all classes are constructed with dicts, how could a class be faster than a dict? Are you sure this entire presentation isn't just conjecture?
@rvm521443
@rvm521443 9 жыл бұрын
He's a core Python / PyPy developer, so it's certainly not just conjecture. If something exposes a dict-like interface it doesn't mean that it's implemented as one and has the same performance characteristics.
@NotoriousPyro
@NotoriousPyro 2 жыл бұрын
Everything in Python is an object. Dicts are objects, functions are objects.
@AlexanderLavin
@AlexanderLavin 9 жыл бұрын
NameError in your code at 11:25...
@buybuydandavis
@buybuydandavis 3 жыл бұрын
p60 vid for a tec talk?
@Eghizio
@Eghizio 4 жыл бұрын
29:30 is that Aja Hammerly ? Sounds like her :D
@the_worst_coconut
@the_worst_coconut 9 жыл бұрын
anyone know what the intro music was?
@spoolboyy
@spoolboyy 8 жыл бұрын
+captain coconut Music "Just Jammin'" by Gramatik
@AJBonkoski
@AJBonkoski 9 жыл бұрын
This is ridiculous and spreading mis-information: There is absolutely no good reason why the dict example cannot achieve the same performance as a C struct when used like an object. In python, a Dict is actually semantically simpler than a generic object. CPython and PyPy may not optimize it, but its 100% doable. You need only to look at the engineering behind LuaJit to see an example. This "flaw" is just a PyPy implementation detail. In X months/years from now there will likely be a better implementation that no longer has these restrictions. As always, profile the code: don't memorize this talk as fact. These conclusions are extremely likely to change.
@0LoneTech
@0LoneTech 7 жыл бұрын
AJBonkoski That's not a PyPy limited implementation detail; the main difference stems from the attribute names being symbols. That implies they get interned, such that they are the same object even if created from different places (for instance, parsing some json). Classes may have further steps, like __slots__, to optimize further. Still, just interning your keys will make a huge difference when you use many similar dicts.
@AlexanderSchepanovski
@AlexanderSchepanovski 6 жыл бұрын
In JavaScript dicts are the same as objects and V8 happily optimizes them, so dicts example is definitely a PyPy implementation detail.
@movax20h
@movax20h 4 жыл бұрын
Use namedtuples if possible instead.
@salkdjfasldkfjsdlk
@salkdjfasldkfjsdlk 9 жыл бұрын
Great talk! Can you please re-record all the tech videos where people um and uh ever 5 seconds? Or at least train them to slow down and just say what they're thinking. Cheers
@AndiRadyKurniawan
@AndiRadyKurniawan 9 жыл бұрын
I believe in python3.4, dict is faster than classes.
@0LoneTech
@0LoneTech 6 жыл бұрын
You're talking of CPython and overgeneralising. Dict is faster than before, but the classes that use it to implement dynamic attributes will be too, and classes with slots can be faster still. In particular, the main culprit of slowness tends to be not fitting in cache, and having an extra dictionary for every object will cost in both indirection and space. And that's before taking into account that class attribute names tend to be interned but dictionary keys don't.
@onlybrad8434
@onlybrad8434 6 жыл бұрын
infinite loop ? 18:40
@aragonnetje
@aragonnetje 4 жыл бұрын
yeah, but not too important to the example
@Xclann
@Xclann 7 жыл бұрын
Talk starts at 1:53.
@futurepython6774
@futurepython6774 2 жыл бұрын
python/django/mysql新教程: python基础:kzbin.info/www/bejne/nWe1n4aIec-Xa68
@shipeng3923
@shipeng3923 10 жыл бұрын
Up
@esphilee
@esphilee 4 жыл бұрын
Want speed, use C. Want simple, use python. Want speed wear running shoe, want simple wear slipper. You can make slipper fast, but it wouldn’t worth the effort, just get the running shoe. Python written in easily understand way, is python suppose to be used.
@kylewood303
@kylewood303 6 жыл бұрын
Sounds like he's talking with full of saliva in his mouth
@this-is-bioman
@this-is-bioman 2 жыл бұрын
Dynamic typing sucks and everyone knows that! So I don't get why don't just drop this stupid idea and make them strongly typed? Like for example TypeScript > JavaScript so why don't you just make JS strongly typed? Or types hints in python!!! You make python dynamically typed, BUT then introduce type hints. It can't be more stupid than that.
@frepkin
@frepkin 9 жыл бұрын
Python is a tool for scientists to help them write articles.
@tissuepaper9962
@tissuepaper9962 2 жыл бұрын
And that's why trillion-dollar companies are using it on a daily basis... Go be stupid somewhere else.
Ned Batchelder: Getting Started Testing - PyCon 2014
42:44
PyCon 2014
Рет қаралды 57 М.
ПРОВЕРИЛ АРБУЗЫ #shorts
00:34
Паша Осадчий
Рет қаралды 7 МЛН
World’s Largest Jello Pool
01:00
Mark Rober
Рет қаралды 79 МЛН
A clash of kindness and indifference #shorts
00:17
Fabiosa Best Lifehacks
Рет қаралды 132 МЛН
What it feels like cleaning up after a toddler.
00:40
Daniel LaBelle
Рет қаралды 82 МЛН
Raymond Hettinger, Keynote on Concurrency, PyBay 2017
1:13:53
SF Python
Рет қаралды 150 М.
Raymond Hettinger - Super considered super! - PyCon 2015
46:52
PyCon 2015
Рет қаралды 122 М.
Thinking about Concurrency, Raymond Hettinger, Python core developer
52:01
Видео с мероприятий {speach!
Рет қаралды 82 М.
Greg Ward - How to Write Reusable Code - PyCon 2015
29:52
PyCon 2015
Рет қаралды 45 М.
K Lars Lohn - Keynote - PyCon 2016
52:06
PyCon 2016
Рет қаралды 41 М.
low battery 🪫
0:10
dednahype
Рет қаралды 898 М.
Rate This Smartphone Cooler Set-up ⭐
0:10
Shakeuptech
Рет қаралды 5 МЛН
НОВЫЕ ФЕЙК iPHONE 🤯 #iphone
0:37
ALSER kz
Рет қаралды 317 М.
Самые крутые школьные гаджеты
0:49
iPhone 16 с инновационным аккумулятором
0:45
ÉЖИ АКСЁНОВ
Рет қаралды 9 МЛН