Skip to content

Light-weight Build/NodeInfo classes using __slots__ #2180

@bdbaddog

Description

@bdbaddog

This issue was originally created at: 2008-08-16 11:36:25.
This issue was reported by: pankrat.
pankrat said at 2008-08-16 11:36:25

The attached patch reduces the memory footprint of NodeInfoBase, BuildInfoBase
and derived classes which are associated with every Node object. Those were
turned into slotted classes.

The overall memory reduction is about 7-9%, but might be different depending on
the build configuration and project.

The pickling must be done manually and the format of the resulting sconsign
entries differ. It is possible to read existing sconsign databases. However,
once the sconsign database was emitted using slotted classes, it cannot be used
anymore from older versions of SCons (it's a one-way transition).

The constructor argument 'node' was removed as it wasn't used anywhere. The
(unused) version is not stored in each instance anymore, only written to the
sconsign database when pickled.

All affected tests were adapted to the changes. Some Alias tests still fail, due
to issue 2177.

Requires Python 2.3 (but can be back-ported to Python 2.2 by removing the
weakref slots).

pankrat said at 2008-08-16 11:38:06

Created an attachment (id=475)
Turn *Info classes into new-style slotted classes

pankrat said at 2008-08-16 13:28:29

Created an attachment (id=476)
Fixed patch now handles AliasInfo and also fixes sconsign tests

gregnoel said at 2008-08-19 12:38:47

Bug party triage.

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

reassigning issue

bdbaddog said at 2015-10-01 19:50:28

Dirk - I looked at the patches and if I'm not mistaken all of these changes are
encompassed in the slots branch merge to default. If so, please close this bug?

dirkbaechle said at 2015-10-06 12:39:58

Resolved with the merge at commit
https://bitbucket.org/scons/scons/commits/9965c5a4ecca51f6a1a62da6f172b91ae8d4f3e
5

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

pankrat attached slot_sconsign4.patch at 2008-08-16 11:38:06.

Turn *Info classes into new-style slotted classes

pankrat attached slot_sconsign5.patch at 2008-08-16 13:28:29.

Fixed patch now handles AliasInfo and also fixes sconsign tests

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions