Trivialize custom rules on creation when possible
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.
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 Please fix the markup in your first comment, for clarity.
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.
Thanks! Your edit helped me out. I'll take it from here now.
@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.
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?
@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.