On Mar 13, 2017, at 9:53 AM, Nicolas Anquetil
<Nicolas.Anquetil(a)inria.fr> wrote:
Reviving this old mail from Guillaume.
I did an analysis on a huge model (>2M entities) we have:
- .mse file: 372.5 MB
- .image file without the model: 86.9 MB
- image with model: 692.8 MB (thus apparently 605,9 MB used by the model)
Then I did a small experiment: I removed the four instance variables of
FAMIXSourcedEntity (sourceAnchor, sourceLanguage, comments, declaredSourceLanguage) and
replaced them by variables in the privateState
for example:
FAMIXSourcedEntity>>comments
"Returns the list of comments defined for the entity."
<MSEProperty: #comments type: #FAMIXComment opposite: #container>
<multivalued> <derived>
<MSEComment: 'list of comments defined in the entity'>
^comments
becomes
FAMIXSourcedEntity>>comments
"Returns the list of comments defined for the entity."
<MSEProperty: #comments type: #FAMIXComment opposite: #container>
<multivalued> <derived>
<MSEComment: 'list of comments defined in the entity'>
"^ comments"
^ self privateState cacheAt: #comments ifAbsentPut: nil
As a result, the .image file is 673.3 MB (thus apparently 586,4 MB used by the model)
Not huge, but almost 20 MB saved, 3% of the initial memory
nicolas
On 10/11/2016 20:49, stepharo wrote:
Thanks
A task of Pavel will be to see how slots usage can reduce that space lost.
For the empty collection having a kind of
- sharing an #() in a classVar
- creating a new collection on use could be a solution.
Le 7/11/16 à 12:16, Guillaume Larcheveque a écrit :
Hi Moose users,
as you may know, at Synectique we experiment lots of issues about memory usage.
That's why i had a look at the number of unused instance variables in one of our
system loaded with a big model from one of our main customer.
Total instance variables: 26.852.653
Used instance variables: 17.393.938
Empty collections: 5.023.508
Recoverable instance variables: 14.482.223
The recoverable instance variables are those with nil or an empty collection (or
MultiValueLink)
As you can see, we can save a lot of memory :-)
Here is my (dirty) code to get that:
countUsedInstanceVariableInForSubInstances: aClass
| usedInstNbr instNbr emptyCollNbr |
usedInstNbr := 0.
instNbr := 0.
emptyCollNbr := 0.
aClass
allSubInstancesDo: [ :anEntity |
instNbr := instNbr + anEntity class allInstVarNames size.
anEntity class allInstVarNames
doWithIndex: [ :e :i |
(anEntity instVarAt: i)
ifNotNil: [ :content |
([
content isEmpty.
emptyCollNbr := emptyCollNbr + 1.
false ]
on: MessageNotUnderstood
do: [ false ])
ifFalse: [ usedInstNbr := usedInstNbr + 1 ] ] ] ].
^ {('Used instance variables' -> usedInstNbr).
('empty collections' -> emptyCollNbr).
('Recoverable instance variables' -> (instNbr - (usedInstNbr -
emptyCollNbr))).
('Total instance variables' -> instNbr)}
--
Guillaume Larcheveque
_______________________________________________
Moose-dev mailing list
Moose-dev(a)list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev
_______________________________________________
Moose-dev mailing list
Moose-dev(a)list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev
--
Nicolas Anquetil -- MCF (HDR)
Project-Team RMod
_______________________________________________
Moose-dev mailing list
Moose-dev(a)list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev