Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merkle tree for style reusability #268

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

anykeyh
Copy link

@anykeyh anykeyh commented Jun 27, 2017

Related to #267

Improve performance using Merkle tree on XML node for equality comparison instead of per-field equality.

This can improve hugely the rendering of an excel with a lot of differents styles (fonts, border etc...), by 2 or 3 magnitudes on my production's company reports.

Yacine Petitprez added 2 commits June 24, 2017 18:04
No more bug on my production excel test set, and ~25x generation speed improvement :P
Copy link
Owner

@weshatheleopard weshatheleopard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. What are the benefits of this? I'm not immediately seeing any.
  2. This change is highly unreadable. Adding so much mutable-at-runtime code is rarely a good idea...
  3. What is the entire brouhaha about node comparison??? I ran tests and I have never seen any single comparison performed in them. == here is a convenience method, not a core method; if you are seeing many calls to it, that means you are using this library incorrectly.

def ==(other)
other.is_a?(self.class) &&
obtain_class_variable(:@@ooxml_attributes).all? { |k, v| self.send(v[:accessor]) == other.send(v[:accessor]) } &&
obtain_class_variable(:@@ooxml_child_nodes).all? { |k, v| self.send(v[:accessor]) == other.send(v[:accessor]) }
self.hash == other.hash
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just because the hashes are equal does not mean the attributes are equal.

You will still need to do the comparison of attributes when the hashes are equal, the alternative may be to use SHA512 hashes or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants