Python Bytes
#226 Teaching Python podcast on the podcast!
- Autor: Vários
- Narrador: Vários
- Editor: Podcast
- Duración: 0:46:03
- Mas informaciones
Informações:
Sinopsis
Special guests: Kelly Schuster-Paredes Sean Tibor Watch on YouTube Brian #1: DataClass vs NamedTuple vs Object: A Battle of Performance in Python Jack Song I’ve been using dataclass for a while now and love it. For some reason, I thought I heard there was some performance hit from them, so I was a bit worried before reading this. Jack came up with “a performance tests to compare the different size and speed when creating, reading and executing functions for Object, NamedTuple and the new DataClass introduced in Python 3.7” Object NamedTuple DataClass create 2.94 µs 2.01 µs 2.34 µs read property 24.7 ns 26.9 ns 24.7 ns nested property 48.1 ns 75.8 ns 52.1 ns execute function 829 ns 946 ns 821 ns size 56 bytes 80 bytes 56 bytes Marvelous. Dataclass is still awesome. At the very least, it’s on the same order of size and speed as other structures. Further questions: This was a limited bit of code, and performance metrics always depen