Here is something I worked on a long time ago that does exactly that. It could be optimised for your purpose, as it can compare most objects and content, classes and types as well if you provide the comparison methods.
I found it a little slow as it is a complete tool and ended up writing specific comparisons as needed, but all the required code is in there.