2009
08.06

Throwing out the laser and scalpel, and pulling out the bone saw this time. Flex SDK Patch 2 (SDK-22552) was rejected. That means it’s time for part 5 of my 3 part series (1,2,3,4) on bug quashing. Once again Ryan gives a solid reason:

Patches are getting better, but I’m still rejecting this one for performance reasons. This ends up creating 2 new Dictionaries at every single internalCompare between two objects. This is quite a lot of memory and garbage collection thrashing.

Which is a valid concern, but I wasn’t sure where else to go. Of course, Ryan had an idea though (probably sensing my lack of algorithmic knowledge)

If I’m thinking about it correctly (I hope I am), I would stick with the one dictionary approach, and in there, I would map objects to objects you’ve already detected as equal objects. The way I would actually represent this would be similar to the Union Find Algorithm and associated data structure. Check out: http://www.users.csbsju.edu/~lziegler/CS162/UnionFind.html (there’s also plenty of info on google). It’s a little more complicated but should be much faster and use less space.

I knew the problem was that you couldn’t know an object’s value unless you traversed the object, but if the object was it’s own child (as you traversed the tree) you ran into the loop before you got a result. The previous patch tracked parents, and created generic object numbers, in this patch I ignored objects (and arrays and lists) in determining the equality of objects. That doesn’t mean I threw them out, I just noted that when an object has the same concrete data and the same types of nestable objects, we’ll call it even. Then we can dig in to each object, list, or array with our new references ready to go.

Related Posts (generated):

1 comment so far

Add Your Comment
  1. [...] This post was Twitted by AdobeApps [...]

Switch to our mobile site