Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCkxM-0006zv-0i for pgadmin-hackers@arkaria.postgresql.org; Mon, 22 May 2017 10:52:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dCkxL-0003mi-JV for pgadmin-hackers@arkaria.postgresql.org; Mon, 22 May 2017 10:52:55 +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 1dCkx6-0002yd-3K for pgadmin-hackers@postgresql.org; Mon, 22 May 2017 10:52:40 +0000 Received: from mail-io0-x22e.google.com ([2607:f8b0:4001:c06::22e]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dCkx2-0008V5-S8 for pgadmin-hackers@postgresql.org; Mon, 22 May 2017 10:52:38 +0000 Received: by mail-io0-x22e.google.com with SMTP id p24so78588051ioi.0 for ; Mon, 22 May 2017 03:52:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pgadmin-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=HWw2EzODQNjRTcktEjxbfNedA7KrXAmSuHBmwPniyKs=; b=ZHNrJQo12+b1Lkao46//e+G2Yvhe73S2CBHWavwV9HccmZsEf9szB/5g011LcpCAUb mIPcEQxZaBqLSOR7viT8LIjSyNrsUy78gElcKaE9kL2DL04wjXnJ7f4oAB+iGFaBdsN2 gjmO2abKNJXKjAvVry7R6YUEFQSDRAgex428C85mIQM2tyEWEaiFfJcM113K6mtw5Be5 /o+bwqmJqdGqccBZnQ/pFIfNB3/gOXhqdsetps+lW7RuL5/IZLjySAYPs15sqCbSl43g 5L9Dp5B6bTrG0pFgKu4y+HU2N+NkYEscwBntSOR+hTsbU9ZD1csNwtMRZDEoxUid+iDW Km8Q== 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=HWw2EzODQNjRTcktEjxbfNedA7KrXAmSuHBmwPniyKs=; b=ZVCqbg0ErhdYzquWpLsxjXHmUfdRFLrL6/x16D9fjBBoIjemKwzOJSFQL9vtMhSifu eEmizFaMIe1PFmdpkpKMu22zgDmXmHVpSNt2D1/UcvuxcgbhLtJOxQFOXjrf4eUalYcK Sl63OOtU4iTbncpclC7VCrPobUNzowgGFsOUrp6KAOEGhjRbxXYF5hCvDRIOzSEX6TtZ PAduNJB/b3x5wkWyxgIUAHxZGElOoZYm0qNanZZMRxOhYlEqUZISrICKd9dIOOtw66s/ YqMbrYyfCa09B6RhRJ5ODI9MAsgmucfpqFVod/WaTjbAbe9B7pQUTmVEkVRAXxcZTCPm GXhw== X-Gm-Message-State: AODbwcBvbRdxjzM8CvhlEtyqELw3Usz7SE2JZoWYYNcSfzERHnvpbDWS q/GBzKl5v3dYGJ/9cCzdM2PJc3JwawYb X-Received: by 10.107.35.210 with SMTP id j201mr20416453ioj.144.1495450355729; Mon, 22 May 2017 03:52:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.174.147 with HTTP; Mon, 22 May 2017 03:52:34 -0700 (PDT) In-Reply-To: References: From: Dave Page Date: Mon, 22 May 2017 11:52:34 +0100 Message-ID: Subject: [pgAdmin4][Patch]: Load module's JS files only when required To: Surinder Kumar Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="001a1140c59e3bc93005501aab0e" 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 --001a1140c59e3bc93005501aab0e Content-Type: text/plain; charset="UTF-8" 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 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 files whereever possible, using the client-side translation. - 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. I'm currently thinking that non-debug/package builds will pre-pack everything for installation. The aim is to have JS HTTP requests be down in single figures to maximise loading time. The are various issues to work through however; at least, how do we handle debug builds, and how do we re-pack everything if a user installs a new module (or updates something). We'd also need to get rid of requirejs. > > Also, I found the http request for gravtar takes much time(depending on > internet speed) to load which increases load time. > https://secure.gravatar.com/avatar/d30aea269994f01256a99a8e7 > 154a328?s=100&d=retro&r=g > > Shouldn't the gravatar image be replaced with custom image ? I don't see > its any use except displaying for user. > Maybe. Doesn't it load asynchronously though? > > *Patch changes:* > > 1) Load following modules JS when 'servers' node expands: > > - Roles > - FileManager > - Backup > - Datagrid > - Grant wizard > - Import/Export, Maintenance & restore > - Sqleditor > > 2) Load Debugger JS when database node expands > > 3) Load Flotr2 when render function is called in dashboard.js > > 4) Load BigNumber library when sorting is performed on Statistics tab in > backgrid.pgadmin.js > > 5) Remove 'backgrid.select.all' from dependency list(user_management.js) > as it had no use. > > After applying this patch, Menu items such "Query tool", "Grant wizard" > don't appear in Tools menu. > I have logged an RM2424 to > track this. > OK. Lets hold fire on this for now though, until I can PoC the work above. Of course, any thoughts or comments are welcome. -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company --001a1140c59e3bc93005501aab0e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi

On Monday, May 22, 2017, Surinder Kumar <surinder.kumar@enterprisedb.com> wrote:
Hi

= As per pgAdmin4 design, template JS files can either be preloaded or load w= hen a specific node expands (by adding for e.g.: when: 'server').

The JS files of several mo= dules found to be loaded when pgAdmin4 loads which results in increasing:
  • the numb= er of http requests
  • latency(greater request time)
  • p= gAdmin4 load time
Tested = on Firefox:

Before applying patch
  • http requests - 143
  • Content size - 3.4 MB
  • Load time:=C2=A04.1s (onload: 524ms= )
After applying patch
    <= li>http requests: 68
  • Content size: 2.1 MB
  • Load time= :=C2=A02.84s (onload: 481ms)
T= his is great work!

However (sorry!) - I'm plan= ning 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 files whereever poss= ible, using the client-side translation.

- 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.

I'm currently thinking that non-debug/package builds will pre-pack e= verything for installation. The aim is to have JS HTTP requests be down in = single figures to maximise loading time.

The are v= arious issues to work through however; at least, how do we handle debug bui= lds, and how do we re-pack everything if a user installs a new module (or u= pdates something).

We'd also need to get rid o= f requirejs.

=C2=A0

Also, I found the http = request for gravtar takes much time(depending on internet speed) to load wh= ich increases load time.

Shouldn't the gravatar image be replaced with custom image ? I = don't see its any use except displaying for user.

Maybe. Doesn't it load asynchronousl= y though?
=C2=A0

Patch changes:

1) Load following modules JS when 'servers'= ; node expands:
  • =C2=A0Roles
  • =C2=A0FileManager
  • =C2=A0Backup=
  • =C2=A0Datagrid
  • =C2=A0Grant wizard
  • =C2= =A0Import/Export, Maintenance & restore
  • =C2=A0Sqleditor
2) Load Debu= gger JS when database node expands

3) Load Flotr2 when render function is called in dashboard.js

4) Load BigNumber libra= ry when sorting is performed on Statistics tab in backgrid.pgadmin.js
=

5) Remove 'backgrid.select= .all' from dependency list(user_management.js) as it had no use.
<= div class=3D"gmail_default" style=3D"font-size:small">
After applying this patch, Men= u items such "Query tool", "Grant wizard" don't app= ear in Tools menu.
I have logged an RM2424 to track this.
<= br>
OK. Lets hold fire on this for now though, until I can PoC th= e work above.

Of course, any thoughts or comments = are welcome.=C2=A0


--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
<= br> --001a1140c59e3bc93005501aab0e--