From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:400c:c09::230; helo=mail-wm0-x230.google.com; envelope-from=arthompson1990@gmail.com; receiver= Received: from mail-wm0-x230.google.com (mail-wm0-x230.google.com [IPv6:2a00:1450:400c:c09::230]) by hurricane.the-brannons.com (Postfix) with ESMTPS id B5FA177CAA for ; Sun, 11 Feb 2018 11:24:51 -0800 (PST) Received: by mail-wm0-x230.google.com with SMTP id j21so5898463wmh.1 for ; Sun, 11 Feb 2018 11:25:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=kDpFLiVg3j0DVWtaV/F+0+Mj6VOCvYXgl7i7HqAX9oY=; b=tRP+yOzjHGfrkWZBdvbOk2sz2/q8HHnF7LyY7g/ZXKc8yL3QzoMDnz2Cao37alaZIE e/25azeTZlTnm5fHYMSY5XxUFaO09vA2vsf9mEVnjMFz4slNmyii6fO4szwf/9kDgzfp h+IJoQXcxFnDNgv32seWi18G68K2cLFYtVlQHEu0UJiMs8yarznGZWky2scs0AvN6A7n f4GQD8CETcOfW3D2TJWDA8kqseCiIexGI3FAgEXiIiJWsqH1EGjqgJ9rlZ0ZBupmcJFX DYpuhAEH28RUtb3kLKoL/juO4hzIdyz8Ef2Tw8Gmft4G46635HvcyVoJ1wSdFhpNqpog Kgsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=kDpFLiVg3j0DVWtaV/F+0+Mj6VOCvYXgl7i7HqAX9oY=; b=PS3LtjAudCHrZEVnsPbUCw9NxFGq2vuCGIzLKrfm63YIW0TDgQAvjCJ+DlF7FCIZAQ 4IlWVUoCOSQ3ZmFFkkNCIX47Q6+MNukNz8pWd7KZ7PyQjyDRZboa84mpJV2ClXT3FhUB dbjgMZ8NIvSkZ8OGqZd3RIxZ65pojP5o/WvKZROmB/l/1zxBBrHFfzbAR2oAVJ7OLSnq ooJh/Pgr7reCa023dbAUTxX8EgpiDhBp3U73eOsYuy5J/DxqAFZMwaYTt62VtaK2sKm+ 0oisLWYtpS/Hq0gNUUaB+yXCvTZfv0zTwYDgtmu06cddzoOI7kK9dIjr30siJ7AmBLbo t+1w== X-Gm-Message-State: APf1xPBSTFK0br8G211z3cQSyJ7YDvaRyQJYMyeE2bpc7c4xbS4j/Z02 uBR/vAdsTn6zmNfGr0q284G4fQ== X-Google-Smtp-Source: AH8x227JH0/WjDf5aXRoimxeR6LRgxfkBrsJiIq8YhPHxXlYQeu7+OwucNyeh4lq7Yz7Qg7NplRnhA== X-Received: by 10.28.92.70 with SMTP id q67mr1794027wmb.43.1518377133795; Sun, 11 Feb 2018 11:25:33 -0800 (PST) Received: from toaster (a.5.9.3.b.f.e.f.f.f.4.4.2.d.a.2.2.4.0.9.2.4.1.1.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1142:9042:2ad2:44ff:fefb:395a]) by smtp.gmail.com with ESMTPSA id s9sm7170700wra.4.2018.02.11.11.25.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Feb 2018 11:25:32 -0800 (PST) Date: Sun, 11 Feb 2018 19:25:31 +0000 From: Adam Thompson To: Karl Dahlke Cc: Edbrowse-dev@lists.the-brannons.com Message-ID: <20180211192531.cfzkkzcrsw6k7vd2@toaster> References: <20180111135351.eklhad@comcast.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180111135351.eklhad@comcast.net> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [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 19:24:52 -0000 On Sun, Feb 11, 2018 at 01:53:51PM -0500, Karl Dahlke wrote: > The css portion, that maps css attributes over to objects, takes 2 minutes to run. > That's not the infinite loop, but it is intolerable nonetheless. > Browse www.stackoverflow.com with db3 and watch 2 minutes go by between > > execute eb$qs$start > execution complete Wow, yeah... that's not good. > The version we got was built to run and handle all situations, and be robust, but obviously not optimized. > Optimizing things is something I'm good at, but it's a lot of code doing something I'm not entirely familiar with, so I would be taking a big bite. > Could it be optimized and still be javascript? Is it primarily an algorithmic inefficiency? > Or would it have to be rewritten in C? > I hope the former, because turning all that into C would be a pain! > There's no real reason to mess with the css parser, that runs once and pretty fast, > but querySelectorAll compares every css directive against every node in the document, which is potentially an n^2 problem. Yeah, that sounds like an algorithm problem, I'll take a look and see if there's anything obvious. May be there's some way to ignore certain directives, I'm not entirely sure yet. Thanks for looking at this.