Bug 1779173 Comment 17 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

I need to check that again with a fresh brain, but I think this should be correct and seems to fix the perf issue:

```js
  function countColumn(string, end, tabSize, startIndex, startValue) {
    // [...]
    for (var i = startIndex || 0, n = startValue || 0;;) {
      // slicing the string before checking the tab char index
      var nextTab = string.substring(i, end).indexOf("\t");
      if (nextTab < 0) { return n + (end - i) }
      n += nextTab;
      n += tabSize - (n % tabSize);
      i = nextTab + 1;
    }
  }
```
I need to check that again with a fresh brain, but I think this should be correct and seems to fix the perf issue:

```js
  function countColumn(string, end, tabSize, startIndex, startValue) {
    // [...]
    for (var i = startIndex || 0, n = startValue || 0;;) {
      // slicing the string before checking the tab char index
      var nextTab = string.substring(i, end).indexOf("\t");
      if (nextTab < 0) { return n + (end - i) }
      n += nextTab;
      n += tabSize - (n % tabSize);
      i = nextTab + 1;
    }
  }
```

the idea is that most of the time was spent in `indexOf`, which makes sens as the string we're looking at is huge.
Getting just the token that needs to be checked makes it faster

Back to Bug 1779173 Comment 17