moosetechnology / Fame

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

Add tests for FMMultiMultiValue and making it faster #53

Closed badetitou closed 1 year ago

badetitou commented 1 year ago

This PR aims to add tests to FMMultiMultiValueLink in order to later optimize it

badetitou commented 1 year ago

add more tests for more combinaison should fail because of a performance test I am working on

badetitou commented 1 year ago

I also perform the tests of all Moose packages and Famix packages in my computer without fails. (I mean 2 tests fails -> but they have the <expectedFailure> pragma. and the three tests of MooseEasy fails but they are not related to these modifications)

badetitou commented 1 year ago

From this PR we increase performance when setting a complete collection. An example is:

[dragons := OrderedCollection new.
1 to: 100000 do: [ :index | dragons add: RPGDragon new ].
hero1 := RPGHero new.
hero1 kills: dragons.
] timeToRun

"OLD Behavior: 0:00:01:11.971"
"New Behavior: 0:00:00:00.158"

Note that the improvement works only when we use directly the kills: method. If we write it like below we will still have poor performance

dragons := OrderedCollection new.
1 to: 100000 do: [ :index | dragons add: RPGDragon new ].
hero1 := RPGHero new.
dragons do: [:dragon | hero1 kills add: dragon ].