Skip to content

Performance issues #45

@aidansteele

Description

@aidansteele

Hi,

I've been using the library a bit more and have come across a new bottleneck. A significant amount of time is being spent in error checking / assertions. While this is very useful during development, once the app has been verified as "correct" it would be great if it was possible to turn these off.

A few examples (these are the most expensive that I've come across):

https://github.com/evolve75/RubyTree/blob/master/lib/tree.rb#L215
https://github.com/evolve75/RubyTree/blob/master/lib/tree.rb#L219-L220
https://github.com/evolve75/RubyTree/blob/master/lib/tree.rb#L369

The problem is: I'm not quite sure how to solve it. The naïve solution is for me to fork the project and simply delete these lines, but maintaining a fork is lame and it might be an issue that others face. Deleting the lines in your repo would be unacceptable because they are very handy during dev.

Ideally, we could opt out of these checks. Sort of like this:

StandardWarning.disable do
  node = Tree::TreeNode.new 1234
end

But with an addition: if the warnings are disabled, the checks shouldn't happen at all -- instead of having the checks occur and not raising. Do you know what I mean or do I need to clarify?

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions