faster-cpython / ideas

1.68k stars 48 forks source link

Aware of msgspec' Struct #627

Closed ssweber closed 1 year ago

ssweber commented 1 year ago

(sorry about the edits, somehow I clicked save before doing anything)

I've been curious at how to speed up dataclasses, and wondered if the team was aware of msgspec's Struct.

The author has a few interesting benchmarks, so I'd thought I'd share (hopefully this isn't unwanted noise).

  | import (μs) | create (μs) | equality (μs) | order (μs) -- | -- | -- | -- | -- msgspec | 9.92 | 0.09 | 0.02 | 0.03 standard classes | 6.86 | 0.45 | 0.13 | 0.29 dataclasses | 489.07 | 0.47 | 0.27 | 0.30 attrs | 428.38 | 0.42 | 0.29 | 2.15 pydantic | 371.52 | 4.84 | 10.56 | N/A   | GC time (ms) | Memory Used (MiB) -- | -- | -- standard class | 80.46 | 211.66 standard class with __slots__ | 80.06 | 120.11 msgspec struct | 13.96 | 120.11 msgspec struct with gc=False | 1.07 | 104.85
dolfinus commented 1 year ago

Why closing?

gvanrossum commented 1 year ago

I never understood this issue (not enough context). It doesn't feel like it's relevant to the main purpose of this repo (discussion about interpreter performance). I believe the author understood that.