https-everywhere icon indicating copy to clipboard operation
https-everywhere copied to clipboard

Trivialize custom rules on creation when possible

Open Bisaloo opened this issue 9 years ago • 8 comments

Type: feature request

Currently, when users create a custom rule using the UI, the rule follows includes the hostname even when a trivial <rule from="^http:" to="https:" /> would be possible.

Code handling the creation of custom rules

Bisaloo avatar Nov 23 '17 08:11 Bisaloo

The idea of this issue is slightly different. I don't think we should change the UI and the text fields, for the reason stated in https://github.com/EFForg/https-everywhere/pull/12754#issuecomment-332023244.

However, we could trivialize rules when the user clicks "Add a new rule for this site".

Bisaloo avatar Nov 24 '17 15:11 Bisaloo

@Bisaloo Please fix the markup in your first comment, for clarity.

jeremyn avatar Nov 24 '17 18:11 jeremyn

I don't use the "Add a rule" functionality and in fact I find it mildly confusing when I look at it. That said, unless there is some evidence that a lot of users out there have a problem with the existing behavior, I think we should leave it as it is.

jeremyn avatar Nov 24 '17 18:11 jeremyn

Thanks! Your edit helped me out. I'll take it from here now.

https-everywhere-bot avatar Nov 24 '17 19:11 https-everywhere-bot

@jeremyn, I don't think we are talking about the same thing.

I am not proposing to change the UI here (that would be a topic for another issue), just the underlying code for better performance.

Bisaloo avatar Nov 24 '17 20:11 Bisaloo

In that case I'm not sure what you want to do. Do you want to change this:

    e("new-rule-redirect").value = `https://${url.host}/`;

to this?

    e("new-rule-redirect").value = `https:`;

Is that meaningfully faster?

jeremyn avatar Nov 24 '17 20:11 jeremyn

@Bisaloo thanks for your attentiveness. The trivialized rules present a huge performance boost under normal circumstances, given the 17,480 active rulesets. For this to be anything but a micro-optimization, a user would have to add at the very least hundreds of rulesets. The addition of this logic in the code can also make it harder to read, for a relatively minimal gain. I'm inclined to think the tradeoff isn't worth it.

Hainish avatar Nov 27 '17 23:11 Hainish