Hm. Not really sure if this code is easier to read. At least it should be minimally faster, doing length checking only when needed
```
            while (candidateOp) {
                if (seenGroups.indexOf(candidateOp.group) === -1) {
                    // reaching third group?
                    if (seenGroups.length <= 2) {
                        break;
                    }
                    seenGroups.push(candidateOp.group);
                }
                if (thisOpType === getOpType(candidateOp)) {
                    // Found an operation of the same type within the last two edit groups on the stack
                    secondLastEditOp = candidateOp;
                    break;
                }
                candidateOp = editOpsFinder.previous();
            }
```
Your call :)