GumTreeDiff / gumtree

An awesome code differencing tool
https://github.com/GumTreeDiff/gumtree/wiki
GNU Lesser General Public License v3.0
933 stars 174 forks source link

add known mappings to zsmatcher #308

Closed cena1001 closed 1 year ago

cena1001 commented 1 year ago

Hello, I have a question about greedybottomupmatcher. In the Lastchancematcher method, I found that MappingStore zsMappings=m.match (src, dst, new MappingStore (src, dst)); If known mapping information is used here, it seems that it can reduce the repetition of matching. That is to say, by directly passing in the information of the already matched subtrees in zsmatcher, this part of the repeated calculation can be skipped in the next matching process. Have you tried this idea before? Is it feasible?

jrfaller commented 1 year ago

Hi!

Thanks for your input. There are two solutions in this case : 1) prune the trees from the already mapped node or 2) change Zhang and Shasha algorithm to take into account existing mappings. I tried 1) but the cost is high since it makes a copy of both trees mandatory for each last chance mapping. Never tried 2) and not sure it can be done, but one promising lead is to use see if it's possible to use the edit "cost" notion for that.

Cheers!