Speed up reveal widget

It turns out that the `localeCompare` function used by `compareStateText()` is very, very slow. Replacing it with a straightforward equality test makes one of my test rigs be 10x faster...

Note that this PR reverts the behaviour of match/nomatch to that before #3157. That change was not backwards compatible in that the switch to localeCompare meant that é === e, now it doesn't again.
This commit is contained in:
Jeremy Ruston 2019-05-10 08:47:00 +01:00
parent dddfb7ce67
commit 7869546fef
1 changed files with 2 additions and 2 deletions

View File

@ -142,10 +142,10 @@ RevealWidget.prototype.readState = function() {
this.readPopupState(state);
break;
case "match":
this.isOpen = !!(this.compareStateText(state) == 0);
this.isOpen = this.text === state;
break;
case "nomatch":
this.isOpen = !(this.compareStateText(state) == 0);
this.isOpen = this.text !== state;
break;
case "lt":
this.isOpen = !!(this.compareStateText(state) < 0);