From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2001:558:fe21:29:69:252:207:37; helo=resqmta-ch2-05v.sys.comcast.net; envelope-from=eklhad@comcast.net; receiver= Received: from resqmta-ch2-05v.sys.comcast.net (resqmta-ch2-05v.sys.comcast.net [IPv6:2001:558:fe21:29:69:252:207:37]) by hurricane.the-brannons.com (Postfix) with ESMTPS id 9EB8977AAF for ; Sun, 11 Feb 2018 13:02:50 -0800 (PST) Received: from resomta-ch2-13v.sys.comcast.net ([69.252.207.109]) by resqmta-ch2-05v.sys.comcast.net with ESMTP id kymAe6ZZPK5JdkymbeTQnv; Sun, 11 Feb 2018 21:03:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20161114; t=1518383013; bh=DYuGFGH1WAG53LvInDxZJ4dTytlotQ5xTTbw2k1+5to=; h=Received:Received:To:From:Reply-to:Subject:Date:Message-ID: Mime-Version:Content-Type; b=SgkqgAySZ5JObUuUs3Kz7b+PycpZCHUSesSG+4zW1NYpCw/ZavIkZI2ZO+3NeBq9M fe27sOM5aTx5/FIuOoBJ+K53AY/c4Eh7Dljy6PUESeQy+/5TqHHBvoicll6Tmm8tQw xzd4CUGLjcQRSBHaLl2Y6QfAHYnwCardQa9VWtYDqZ4sENMIOY5s2s0mmVyBnWVP7o d7XJv+1Yj2aB5SdF0ZYdGizORwpfCuUTgaKk9fbcL88w64HHtrKa6QS81JeSHNZtBr Ht5oZObORONwKXhTyOQ2hX1wE18IN8fq+9mi8RVBUqyHpJYh+LClD+kHw+oBzYo118 VWut508MsqNwg== Received: from unknown ([IPv6:2601:408:c300:8f09:21e:4fff:fec2:a0f1]) by resomta-ch2-13v.sys.comcast.net with SMTP id kymbek78hXtXFkymbeNbVy; Sun, 11 Feb 2018 21:03:33 +0000 To: Edbrowse-dev@lists.the-brannons.com From: Karl Dahlke Reply-to: Karl Dahlke References: <20180111135351.eklhad@comcast.net> <20180211194301.gx6i6nago4ietkxo@toaster> User-Agent: edbrowse/3.7.1 Date: Sun, 11 Feb 2018 16:03:33 -0500 Message-ID: <20180111160333.eklhad@comcast.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=nextpart-eb-181961 Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfM/n0wBAt3OoTmfHpZr2Rc0LBunpK0+vEMaf+ranw6m/nkvCWajnA/HT51aC5dqwardv3vGO51e0JKNaPmVtHnpIGn6kUIdHwFJDedT32lALza0sS6aA knrR9oGHYBcmcyylBAID94HgtmnU6WTsGfhZKmRt5Nk4m/8LarLgrM/F Subject: [Edbrowse-dev] stackoverflow and css X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.25 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 21:02:50 -0000 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --nextpart-eb-181961 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ok, querySelectorAll was built to run once and work, without regard to = the fact that it might run thousands of times over. Imagine a routine querySelectorAll_prep that traverses the document = tree and does things like hashnodes[e.nodeName].push(e); So all the div nodes are in the array hashnodes["div"}. If you have a div selector then just run down this array. But more common is nodetype with class. hashnodes[e.nodeName + "||" + e.className].push(e); If the selector is div.class then you just scoot down a very short = array. Beyond this, there are no checks needed for an unadorned div.class, = just apply the attributes. Even if there are other checks, like div.class and foo=3Dbar, at least = you have a short array to check. You might also set hashnodes["||" + e.className].push(e); That lets you look for .xyz i.e. any element of class xyz. And you need to put every element in hashnodes["*"] because some = selectors are just exotic and not tied to a particular node type or = class. But it's a little more complicated. A selector could be p.dog,div.cat That's two selectors in one. We would have to separate them, split(","); and iterate over the two selectors, as though they had been separate = from the get-go. Not hard, just another wrinkle. As I do today, getComputedStyle needs to run querySelectorAll on one = particular node, not needing any of the above machinery. That is the second argument to querySelectorAll as it stands today, a = particular node to start at, but it tries to do the subtree, so I remove the children first, then = run querySelectorAll(selectors, e), then put the children back. It's = gross. See third.js line 3947. Before you or I or anyone takes a whack at this, I'm going to list out = all the selectors from stackoverflow, to get an idea of what is there, and what kind of savings we might = realize from the aforementioned node hashing. Glad to see you back on the list, we miss your talent and your insights. Maybe you could tackle one of these projects, if you have time, gopher or querySelectorAll optimization or infinite loop debugging, whichever one tickles your fancy. Or anyone else who wants to step up. I'll keep doing some light research. Karl Dahlke --nextpart-eb-181961--