Awful performance in Firefox with lots of lines

I work with large files with lots of lines (50k+). Firefox chokes on them and becomes unresponsive very quickly. Chromium performs much better.
Try the following on

var s = 'X'
var lines = s;
for(var i = 0; i<50000; i++){
  lines = lines+'\n'+s

Firefox takes more than 10 seconds, Chromium does it in a few ms.
It seems to be the calculation of the longest line that takes ages on Firefox. I wonder why that’s the case and if I can do anything about it.


I’m seeing this take 50ms in Chrome, and 230ms in Firefox 31. I wouldn’t call that awful (50k lines is quite a lot). When I look at the profile, the time seems mostly spent on allocating Line objects, which isn’t too surprising. Which Firefox version were you testing with?

I’m using Iceweasel 31.2.
Apparently it is Firebug that makes it take so long, if I remove the profiling, things are much faster. I thought, Firebug would be able to track the net times, sorry.

No problem. I’ve let Firebug confuse me like that too. (And have stopped using it entirely, mostly because of such shenigans.)

1 Like

What do you use for profiling? Firefox’s internal developer tools don’t seem to be able to do that and I can’t really get used to them anyway after having used Firebug for many years.

Chrome, mostly. But FF’s built-in devtools are also getting quite good – they take some getting used to, but the functionality is all there.