weppos / publicsuffix-ruby

Domain name parser for Ruby based on the Public Suffix List.
https://simonecarletti.com/code/publicsuffix
MIT License
620 stars 109 forks source link

Don't duplicate rule indices when creating index. #77

Closed ags closed 8 years ago

ags commented 9 years ago

By default, the rule index is re-created when new rules are added to a list.

The index isn't cleared when this happens, so the index allows repeated addition of the same indices for the same rule. This in turn slows down List.find.

We (Flippa) add 39 new rules to the default list, which means for a TLD like '.it', 15,129 rules are checked instead of the 369 unique ones.

ags commented 9 years ago

@weppos Is there any chance this could be looked at? We were seeing frequent SystemStackErrors in production until this change.

If this gem needs help with maintenance, I'll happily lend a hand :)

Thanks!

weppos commented 8 years ago

Sorry for the silence @ags, I merged the patch. Thanks!

weppos commented 8 years ago

I've just released 1.5.3

ags commented 8 years ago

Thanks @weppos! :+1: