|
|
Subscribe / Log in / New account

Accessors vs attributes

Accessors vs attributes

Posted Aug 6, 2025 2:30 UTC (Wed) by DemiMarie (subscriber, #164188)
In reply to: Dynamism or performance: pick two by q3cpma
Parent article: Python performance myths and fairy tales

My understanding is that Common Lisp defstruct produces accessors that only work on something that is exactly an instance of the strict. This means that the accssesors only need go check that the tag (in the pointer) and type (stored in the object header) are correct before loading the value from a fixed offset. That is going to be quite a bit faster than a dictionary lookup.


to post comments

Accessors vs attributes

Posted Aug 6, 2025 10:54 UTC (Wed) by unya (guest, #102269) [Link]

DEFSTRUCT is pretty old and explicitly tuned for speed in design. One of the big issues in developing something with is that that not only are the accessors very simple, they are also inlined by default (which is part of why they are very simple)


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds