Fixing allPropertiesDo duplications v2 - #120
Conversation
…, but in allProperties
allProperties will extract properties and traits, instead of allPropertiesDo::
…nd add superclass logic
… uses her superclass allPropertiesDo:
|
Thanks, that looks better :) Also, have you considered using an |
|
I just wanted to keep the old version safe, i'm still a newbie using GH, sorry :) . |
|
'foo' == 'foo'. "true"
'foo' == 'foo' copy. "false"
#foo == #foo copy. "true"I'm not sure if it can work without relying on the name, you'll have to try it if you're curious. |
|
I will search how I can use |
|
Note to myself, we also need to fix the case where a property is in a superclass and a trait |
|
Tests are failing because |
|
So here we have two problems. The tests are depending on Famix and also the behavior of #allProperties changed. I explained to antonin how to do tests without using Famix. Also he will update the PR to use once again its previous implementation that worked, and he will add a cache on #allProperties so that we do not have perfomance regression on model import |
b6ac5b2 to
1657b2b
Compare
|
I pushed a third version using a cache. desc := FamixJavaClass mooseDescription.
"Version 1: allProperties defined in terms of allPropertiesDo:"
[desc allProperties1 ] bench. "12,707 iterations in 5 seconds 1 millisecond. 2540.892 per second"
[desc allPropertiesDo1: [ :prop | "nothing" ] ] bench. "13,000 iterations in 5 seconds 2 milliseconds. 2598.960 per second"
"Version 2: allPropertiesDo: defined in terms of allProperties, remove duplicates with internal set"
[desc allProperties2 ] bench. "170,219 iterations in 5 seconds 2 milliseconds. 34030.188 per second"
[desc allPropertiesDo2: [ :prop | "nothing" ] ] bench. "191,604 iterations in 5 seconds. 38320.800 per second"
"Version 3: allProperties defined in terms of allPropertiesDo:, closer to Version 1, with cache"
[desc allProperties3 ] bench. "449,072,055 iterations in 5 seconds. 89814411.000 per second"
[desc allPropertiesDo3: [ :prop | "nothing" ] ] bench. "7,616,784 iterations in 4 seconds 999 milliseconds. 1523661.532 per second"
Our V3 is 35 000 times faster than the V1, and around 2500 times faster than the V2. |
|
Caching is obviously faster, but uses more space. |
Following up the PR #119
I made a second version of the fix for duplication of properties.
Fixed this problem by putting back the original pattern to keep optimization, and adding a method.
allPropertiesDo: block visited: aSetto filter the properties duplications that we encounter thanks to a set.Is this version better @Gabriel-Darbord @jecisc ?
Closes #118