28

The Questions page on Stackoverflow seems to spend some 6 seconds "Scripting" according to Chromium.

Stackoverflow taking its sweet time

This only happens when logged in and is 100% reproducible in different browsers on multiple machines.

Just to be clear: I don't think it has anything to do with the network, as everything else (including not-logged-in Stackoverflow) works just fine.

11
  • 13
    I suspect the issue is with your hundreds of ignored tags.
    – Oded
    Commented Feb 4, 2017 at 18:20
  • @Oded That could well be, thanks! Do you have suggestions that would help speed up loading the page? Also, I haven't ignored more tags recently and I remember the page used to load quite quickly. Did something change?
    – cnicutar
    Commented Feb 4, 2017 at 18:23
  • 4
    It is possible - I will have to consult a colleague about that. You can test the theory by removing some of your ignored tags (in particular ones that have wildcards) and see if that improves performance. Of course, you can always add them back.
    – Oded
    Commented Feb 4, 2017 at 18:35
  • 2
    @Oded Your theory checks out: I removed all the tags containing wildcards (and only those) and everything is fast again. Thanks for the suggestion.
    – cnicutar
    Commented Feb 4, 2017 at 18:54
  • 5
    @cnicutar hi, I'm the main developer for tag related filtering (etc); I want to investigate this to understand it and hopefully fix it - can you remember what your original ignore list was before you removed the wildcards? Commented Feb 6, 2017 at 9:20
  • @MarcGravell I backed the list up but I don't have access to it at the moment. When I do gain access to it (in a few hours) should I post it here or do you know of a better place?
    – cnicutar
    Commented Feb 6, 2017 at 9:24
  • @cnicutar here's fine - or you can email me via [email protected] Commented Feb 6, 2017 at 9:25
  • 7
    apparently we've managed to recover the list from when Oded looked on the weekend - don't stress about finding them Commented Feb 6, 2017 at 9:29
  • As someone who uses regex frequently wildcards tend to be slow. I don't think there is a real fix for that. Commented Feb 6, 2017 at 10:43
  • 2
    @HopefullyHelpful 6seconds is a bit extreme though don't you think? I'm sure it could be tweaked to become faster. Commented Feb 6, 2017 at 10:53
  • 2
    @HopefullyHelpful I think we did ok... (see answer) Commented Feb 6, 2017 at 12:27

1 Answer 1

31

Thanks for calling this to our attention. This was due to the client-side post-processing (highlighting, hiding, etc) that we do on the results.

Since you're asking from the context of Stack Overflow, here's some additional technical details: when wildcards were in use, the selector used was a suboptimal regex match via :regex(class, ...) in jquery - when in the "starts-with" case it could be done far more efficiently with a [class*=...] match. Since you had lots of wildcards, this was absurdly expensive. The selector was also doing a lot of duplicate work, so we've replaced that with an initial "find all the candidates" step followed by a .filter on a simplified selector - essentially $('outer1[inner1],outer2.inner2,...,outer327:inner327) to $('commonOuter').filter('[inner1],.inner2,...,:inner327').

The result of both of those things combined is quite dramatic:

before: 'ignored' took 8235.450ms

after: 'ignored' took 20.505ms

(oh, we also added some client-side logging if it goes over a reasonable time)

So: you should be OK to re-enable your wildcard filters now.

We also plan to move more of the ignored-list filtering to our "tag engine" server (the v1 server couldn't really cope with this, but the v2 server we're using now should be fine, especially when we get our GPUs racked). So: only good things!

Please let me know if you see the same performance increase that I see, or whether it is still a problem.

1
  • 1
    I restored all the ignored tags and everything works just fine and is very speedy. Thanks a lot for resolving this issue and for deploying the fix so quickly!
    – cnicutar
    Commented Feb 6, 2017 at 20:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .