Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCmdV-00053B-Oy for pgadmin-hackers@arkaria.postgresql.org; Mon, 22 May 2017 12:40:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dCmdV-0004gK-75 for pgadmin-hackers@arkaria.postgresql.org; Mon, 22 May 2017 12:40:33 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dCmdU-0004gA-Cw for pgadmin-hackers@postgresql.org; Mon, 22 May 2017 12:40:32 +0000 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dCmdQ-00027h-Pe for pgadmin-hackers@postgresql.org; Mon, 22 May 2017 12:40:30 +0000 Received: by mail-wm0-x22c.google.com with SMTP id d127so150674804wmf.0 for ; Mon, 22 May 2017 05:40:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=OfLJkwdew6bUoJZS7mMC5DoU8Dd6xKXvGB5pTM9O4Bo=; b=wtvWkzUEjQdL6m1JssQZe2n7wq5Sk08XNJf3TIDnIlv036AlB4m5qqo4qhKu0gyV6l lEGbG46f7QznwEtatyZhnhJnlFvQbEWPCCnDgt2SuX0m4riDJIxCNIaxPKoPFWWntHLb +gAlp9IDK29HwQnBlPzc00VASm/of6821nDGKbyxweZxSNfm3IOtnGfCUoT9lStWg+Ho cxGrLBNz84X5E9RFija9/NUaLqliWbsRy+Bu/GbcgDEIfX6jPuKGitVusOQAY3nF+mqm FEdPFh62YY9/JFXAooloMgULSMk5JXPRaEsUEODo2AX8T0cMNTS6S+TznyZDeJYjgvqG vWiQ== 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=OfLJkwdew6bUoJZS7mMC5DoU8Dd6xKXvGB5pTM9O4Bo=; b=JknDyJvvPyomMTjwgUPzOTqZKkZ0fJSjbuIbUprKi1O55mXvhVGh71L7X5oXNgUMDX qfOOcU5PR+htEssVAJCniQsVHvWHRI8cdOJPvXJYAxYDmygNvLrt07c5T49tGtEJTl4j Ebqfr7Nzyj6KFzfmRkzmxSr13Rgpph0XMJYLtb40xEKnrgngXjfTQ10IMekaZNJsD4js SWLYA8oLPRq4Ef3xsCOU59menKOdivLN4WIsCgPnzCLS31crVi+Ae2O7rAknyiC9uly2 BVz0LZNvDqESn2AzJgqc8OHK8m0ziyDDl2hB/38lEgCoPuHwzx8V2oimmdmY1fnu6JL/ yyxw== X-Gm-Message-State: AODbwcAkdD1NgTNsZaaRsn5SIdliApMvklSjXhYAIkrhr5/zwC+T7czN TzVErqLDn+wok7He7V0winLNvGxLvroX X-Received: by 10.28.169.198 with SMTP id s189mr24757571wme.91.1495456826925; Mon, 22 May 2017 05:40:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.19.138 with HTTP; Mon, 22 May 2017 05:39:56 -0700 (PDT) In-Reply-To: References: From: Surinder Kumar Date: Mon, 22 May 2017 18:09:56 +0530 Message-ID: Subject: Re: [pgAdmin4][Patch]: Load module's JS files only when required To: Dave Page Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="001a114b9788f2564b05501c2ce9" 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 --001a114b9788f2564b05501c2ce9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 loa= d >> 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 the > 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 file= s > whereever possible, using the client-side translation. > =E2=80=8BYes. It will be then easier to cover most of the JS code for minif= y if client side =E2=80=8Btranslation is used. > > - 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 False 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