Skip to content

Light-weight Attrs class using __slots__ #2178

@bdbaddog

Description

@bdbaddog

This issue was originally created at: 2008-08-16 04:34:14.
This issue was reported by: pankrat.
pankrat said at 2008-08-16 04:34:14

The attached patch reduces the memory footprint of Attrs instances which are
associated with every Node object. Most Attrs() only store the 'shared'
attribute. Using slots avoids creating a dict just to hold this attribute. If
more information is stored in attributes, a dict is still created in the
dict slot.

The memory saved is not much (less than 100 Byte per Node object).

Requires Python 2.3 (due to the required dict slot).

pankrat said at 2008-08-16 04:35:16

Created an attachment (id=473)
New style slots class for Attrs

gregnoel said at 2008-08-19 12:35:55

Bug party triage.

dirkbaechle said at 2014-05-17 15:09:56

reassigning issue

bdbaddog said at 2015-10-01 19:18:17

Closing this is in 2.4.0 with Dirk's changes.

More information about this issue is at http://www.scons.org/wiki/LudwigHaehne/SlotClasses.

pankrat attached slot_attrs.patch at 2008-08-16 04:35:16.

New style slots class for Attrs

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions