moosetechnology / Fame

Fame is a meta-modeling framework for executable models.
MIT License
4 stars 10 forks source link

Make FMMany more memory efficient by sharing a default value #71

Open jecisc opened 9 months ago

jecisc commented 9 months ago

I did some tests in an image and I found this:

FamixJavaEntity allSubInstances size. "1.941.951"

FMSlotMultivalueLink allInstances size. "3.454.420"

(FMSlotMultivalueLink allInstances select: #isEmpty) size. "2.411.735"

So I have an image with 2 millions entities. In total they have 3.5millions collections to point to other entities. But out of those, 2.4 millions are empty which means we have collections taking up space for nothing.

My idea is to improve the FMMany so that it does not initialize itself with a FMSlotMultivalueLink but with a read only singleton of a Null entity that would get replaced the first time we add an element. Like this we would get only one instance in the image.

Gabriel-Darbord commented 9 months ago

Wasn't that done before using the now deprecated FMNullMultivalueLink? I would also like to make FMSlotMultivalueLink a subclass of OrderedCollection, which should help regarding memory consumption.

jecisc commented 9 months ago

FMNullMultivalueLink had one instance by collection without value inside but is was taking less space than FMMultivalueLink.

Here the idea would be to have one instance in the image.