Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDEoX-0007vf-Nw for pgadmin-hackers@arkaria.postgresql.org; Tue, 23 May 2017 18:45:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dDEoW-0004QS-QI for pgadmin-hackers@arkaria.postgresql.org; Tue, 23 May 2017 18:45:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dDEoH-00041s-FH for pgadmin-hackers@postgresql.org; Tue, 23 May 2017 18:45:33 +0000 Received: from mail-vk0-x22c.google.com ([2607:f8b0:400c:c05::22c]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dDEnw-0004XE-RR for pgadmin-hackers@postgresql.org; Tue, 23 May 2017 18:45:32 +0000 Received: by mail-vk0-x22c.google.com with SMTP id y190so63516552vkc.1 for ; Tue, 23 May 2017 11:45:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pivotal-io.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=IoEBCpO/PqtcLaEbDv+XzM7J/yOCRoZGOrTOcij6wo0=; b=YnTssXesI6Vg9YrWr4ACec/YO3H6ajrel/sY0iKKSbqZUpYKKY6BhJXEvGZEiRee87 TIkpDz3VMIBYFcPC1fgQkhDwCrxPOzRufz4jz4gv0xRbeP7z0MrDntl+B9BtRN5IqltO +3jxs92zJxhPuAofIFk6fvzMyPyRwv5H+kVVUhRzUHbmBFSBB91recdxB0aqDmeBT4rw TqS0Va5DxIuO+Sl71VB8fsfC3mOvRpVgzxYKJQkBkDv1wI7I5y5lIWifEX2iPLVRM5Cc t+SWjRgMsex/tAZlDHp5MzqSP1vN6mV4a7MeyLpiLlGqP9VJ3VbZMTXJ0X2EoYY349MP e6dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=IoEBCpO/PqtcLaEbDv+XzM7J/yOCRoZGOrTOcij6wo0=; b=STeQ6ECGYMdZjvY33SktGbl0t5DC0+YHJpqLsWfwPZXBsRjUXMbAJDKEsPV2Ftp4iq ni2KZB0bLH2rVLhkWKtUyxbueduQtUbUQl0t6lcDshFmZ0wS5wxv2aIQ4f2WbSKmMiE0 /6k/y9Rl9J281YzsHf87nxiK7LOMuWCjW8/Wt7b6A6vdNplv6zerpld0kwG7dta5Qu50 u2304GG2gy6fuc6G955MpmU3V+m6eEiaO9r1GR670pfoqpyRqnzYaKmtVDy9iTbvArJu MpJCANZnBKJOAU7AX919rEFAz7sVyOW87NJ5x/HDjYfhAGyQ6XD5NoK9gF6VVsMR6XTs CZMg== X-Gm-Message-State: AODbwcB34HaVafmMSWvusijYYdoe1zS8ZnhYucKtiwboI+hclRSQwueX ap4o3dgI6z88q5PXe+U0c9EmaUx6CwMt X-Received: by 10.31.125.66 with SMTP id y63mr299651vkc.33.1495565110315; Tue, 23 May 2017 11:45:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.47.13 with HTTP; Tue, 23 May 2017 11:45:09 -0700 (PDT) In-Reply-To: References: From: Joao Pedro De Almeida Pereira Date: Tue, 23 May 2017 14:45:09 -0400 Message-ID: Subject: Re: [pgAdmin4][Patch]: Load module's JS files only when required To: Dave Page Cc: Surinder Kumar , pgadmin-hackers Content-Type: multipart/alternative; boundary="94eb2c14949023a44a055035634e" X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgadmin-hackers Precedence: bulk Sender: pgadmin-hackers-owner@postgresql.org --94eb2c14949023a44a055035634e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello =E2=80=8BI wrote few grunt tasks using r.js optimizer this weekend > > How did it compare to webpack? I am already starting to wonder if Grunt is the best way to do this though. > It might be easier (though not quite as efficient) to have the Python > module all return their static/template JS code at initialisation, > effectively dynamically building a single packed file containing nearly > everything. We could. Are you saying that the app should bundle js every run? To be fair, this is what we're currently doing with Grunt, but it feels like we should change this for non-development use. Yeah, though I think there are more considerations we haven't yet thought > of. Something we aren't clear on is the end-user use case of dropping modules into existing installations. Is this achieved via installer? George & Joao On Mon, May 22, 2017 at 5:33 PM, Dave Page wrote: > Hi > > On Monday, May 22, 2017, Surinder Kumar > wrote: > >> Hi >> >> On Mon, May 22, 2017 at 4:22 PM, Dave Page wrote: >> >>> Hi >>> >>> On Monday, May 22, 2017, Surinder Kumar >>> wrote: >>> >>>> Hi >>>> >>>> As per pgAdmin4 design, template JS files can either be preloaded or >>>> load when a specific node expands (by adding for e.g.: when: 'server')= . >>>> >>>> The JS files of several modules found to be loaded when pgAdmin4 loads >>>> which results in increasing: >>>> >>>> - the number of http requests >>>> - latency(greater request time) >>>> - pgAdmin4 load time >>>> >>>> *Tested on Firefox:* >>>> >>>> Before applying patch >>>> >>>> - http requests - 143 >>>> - Content size - 3.4 MB >>>> - Load time: 4.1s (onload: 524ms) >>>> >>>> After applying patch >>>> >>>> - http requests: 68 >>>> - Content size: 2.1 MB >>>> - Load time: 2.84s (onload: 481ms) >>>> >>>> This is great work! >>> >>> However (sorry!) - I'm planning on working on an alternative change on >>> my flight in a couple of hours. Joao has broken the Grunt code out of t= he >>> History tab patch for me to work with - the idea is something like: >>> >>> - We continue to migrate all the JS out of templates and into static >>> files whereever possible, using the client-side translation. >>> >> =E2=80=8BYes. It will be then easier to cover most of the JS code for mi= nify if >> client side =E2=80=8Btranslation is used. >> > > Unfortunately, I looked at this on my flight and it looks like it'll be a > mammoth task. Many/most JS files also currently use the url_for template > function - so we need to figure out how to replace that with JS code firs= t. > > >> >>> - We then have a set of Grunt tasks that will collect all the static JS= , >>> minimise it, and pack it into a single file to load at startup. >>> >> =E2=80=8BI wrote few grunt tasks using r.js optimizer this weekend which= : >> >> 1. Finds all static JS file recursively into the modules using regex >> pattern and then creates the tasks to minify each JS file and store its >> 'min.js' in same directory and loads min.js when current_app.debug is Fa= lse >> else returns JS file. >> > >> 2. A task to merge given list of CSS files into a single file and then >> minify using 'grunt-contrib-cssmin' task and then insert that file with >>