Page 1 of 1
Firefox hangs with large ABE rule
Posted: Wed Feb 19, 2014 7:52 am
by access2godzilla
I have a rather large
ABE rule generated from the hpHosts ATS list. However, it seems that with large ABE rules, Firefox's hangs whenever I try to open the error console, and I have to terminate Firefox manually.
What changes needed to the ABE rule so that the problem does not occur?
Re: Firefox hangs with large ABE rule
Posted: Wed Feb 19, 2014 10:34 am
by Thrawn
Pastebin is reporting that that paste has been removed?
I wouldn't suggest using ABE as an ad/malware blocker this way. You might be able to, but there are much better tools for the job, like ABP.
But if the size of the ABE messages in the console is the issue, you could simply try splitting it into multiple rules.
Re: Firefox hangs with large ABE rule
Posted: Wed Feb 19, 2014 11:49 am
by Giorgio Maone
Each "Site ..." uses an AddressMatcher object which in turn gets compiled to a rather unoptimized regular expression, unless, of course, it's recognized itself as a single regular expression literal: you can force this recognition by starting the expression with the "
^" character.
Therefore, the best way to "import" an external list as an ABE rule is making your import script transform it into one single, possibly
optimized regular expression and feeding it to a single "Site ..." clause.
Re: Firefox hangs with large ABE rule
Posted: Tue Feb 25, 2014 10:51 am
by access2godzilla
I wrote a "converter" based on Giorgio's hints (thanks!). However, Noscript doesn't seem satisfied with the regex and gives an error: "line 2:6 no viable alternative at character '?'".
The converter:
http://pastebin.com/2upXX3yd
The generated rule, run on hpHosts ATS:
http://pastebin.com/9LFHJ266
What could be the problem now? Something in my code? Something in the Regexp::Assemble module?
Re: Firefox hangs with large ABE rule
Posted: Tue Feb 25, 2014 11:22 am
by Giorgio Maone
ABE recognizes as regular expressions clause arguments starting with "^", so just prepend a "^" character to your optimized expression.
Re: Firefox hangs with large ABE rule
Posted: Tue Feb 25, 2014 11:55 am
by access2godzilla
I made the necessary modifications to the above script (and consequently the generated rule also changed); I've edited the pastebin content to reflect this. Thanks for the pointers, Giorgio.
I'm quite satisfied with the results; seems like I can use this as a lightweight ad-blocking tool on some of my older computers which poorly perform with ABP.
Re: Firefox hangs with large ABE rule
Posted: Tue Feb 25, 2014 10:29 pm
by Thrawn
Someone has beaten you to the idea.
Re: Firefox hangs with large ABE rule
Posted: Wed Feb 26, 2014 8:07 am
by access2godzilla
Thrawn wrote:Someone has beaten you to the idea.
You see, I'm not running to the patent office with that fifty line Perl script; and the main logic is the contribution of a person from stackoverflow, so even if I were to try to do so my hopes are dashed.
I'll have to see from where exactly they get their list, though.
Re: Firefox hangs with large ABE rule
Posted: Wed Feb 26, 2014 10:01 am
by Thrawn
The addon page claims it's based on EasyList. I believe it's not quite as comprehensive, though. Speed is the key.
One possible 'best of both worlds' approach is mentioned
here.