08-12-2008 09:22 AM
Spatial has done a lot to be able to share entities, e.g. geometric entities can be shared between multiple topological entities within a body.
When a body is colored, in our cases different faces mostly have different colors. That means in our case we have to add an ATTRIB_RGB to each face, edge and vertex. As there are mostly about three colors involved we have a significant amount of data (ATTRIB_RGB, rgb_color) that is duplicated for many faces, edges and vertices. This amount of information makes about 30% of the file size of a saved body.
Wouldn't it be better if such identical color attributes could be shared be their 'owners'?
09-08-2008 11:55 AM
To your question: "Wouldn't it be better if such identical color attributes could be shared be their 'owners'?"
The answer is yes. But unfortunately, it doesn't work that way. The code has evolved to expect attributes to be singly owned.
The ATTRIB_RGB is a very simple entity that requires about 100 bytes of storage. It uses 3 doubles to define a color, which may be overkill. It backs-up its data by value, which means that all copies are the same size. We've traded efficiency for simplicity. Nonetheless, it probably works well for most applications because they don't create many of them.
You can realize about a 25% memory savings if you don't use ATTRIB_RGB but instead create a custom attribute to manage colors. This custom attribute can point at a use-counted rgb color structure instead of containing the color by value. You can still save as ATTRIB_RGB for interoperability purposes.
Just a thought,