Plots2: Outreachy '20: Optimize Performance and accessibility Project Planning

Created on 7 May 2020  ·  24Comments  ·  Source: publiclab/plots2

Hey everyone! This is a planning issue to map out all the tasks to be covered in the upcoming weeks and create a room for further discussions and improvements.

Note: see original proposal here: https://publiclab.org/notes/itm2017004/03-12-2020/outreachy-proposal-optimize-performance-and-accessibility-of-public-lab-content

Performance Analysis and Improvement:

Tasks:

  • [x] Using WebpageTest and PageSpeedInsight to study the current waterfalls.
  • [x] Minify js by setting uglifier gem in config/production.rb file. (#7937 closed #8159 open)
  • [x] Minify css using yui or sass-rails (Already done)
  • [x] Removing the older version of font-awesome currently being loaded (2 versions being used now 5.12 and 4.7) and replacing it with a gem so that it is included in the asset pipeline. More info can be found here (all closed #7938 and #8026 #8041 )
  • [ ] Async or defer attributes to be added to js files to reduce first paint time.(more information here
  • [x] Replace jquery with cdn since it is widely used and would be available as cache in most client’s browser.More info can be found here,here and here.This will allow us to externalize jquery from application.js allowing us to call application.js asynchronously. (#8161 open - tests failing need to investigate after some pending work gets merged first)
  • [x] Check if all the js files are duplicates (i.e if already present in the manifest file as well as assets.rb) and remove redundancies. (#7958 open)
  • [x] Only load critical css for the first paint and rest asynchronously using loadcss-rails and critical-path-css-rails (open #7996)
  • [x] Remove CDN and other links otherwise available from asset pipeline in file app/views/csvfiles/new.html.erb (
  • [x] Replace bootstrap-slider.js with minified js and async tag or add it into the asset pipeline.(Also can be considered for removing since it is obsolete and most of the code isn't used) (#7939 open)
  • [x] Minify leaflet js files by calling them from already present asset pipeline (closed #8087 and open #7945 )
  • [x] Minify esri-leaflet-renderers.js (closed #8164)
  • [ ] Replacing the delivr cdn of mathjax with an alternative npm or serve it in a minified manner
  • [ ] Adding font-display:swap tag for fonts imported to allow it to fallback to normal font in the first paint till it gets loaded.(Check for browser compatibility or invisible text issue)
  • [x] Add lazy loading for images and serve them in next-gen formats.More info can be found here. (#8043 )
  • [ ] Add Rack deflater to gzip files that are not already gzipped.More info can be found here

New work added (not defined in the scope before)

  • [x] Remove n+1 queries (#8272 #8269 #8268 #8267 #8183 closed #8191 #8190)
  • [x] Replace .length/.count with .size (main issue #8194 ftos created by @cesswairimu :clap: more ftos to be created ahead)

Accessibility

Tasks

  • [x] Add labels to forms wherever applicable.(break-me-up tag can be used to break it down into several components) (Flagged as missing form label)
  • [x] Add aria-label if we don’t want the label to be visible but accessible.(break-me-up tag can be used to break it down into several components) (Flagged as missing form label for cases where we want hidden form labels)
  • [ ] Check and test if on zooming into text all the elements of the page are visible or not and apply changes accordingly.(break-me-up tag can be used to break it down into several components)
  • [x] Add accessible names to button to prevent screen readers from announcing it as “button”.(break-me-up) (Flagged as empty button problem)
  • [x] Add meaningful text into links to promote uniqueness and accessibility.(break-me-up) (Flagged as empty link problem)
  • [ ] Add alternative text for images to promote SEO and accessibility.(break-me-up) (#8106 stuck and not sure how to work on this TBD after printability)

Worked on a route-to-route basis by testing against WAVE (#8054 #8028 #7995 #7989 #7977 #7975 #7968 #7966 #7962 )
FTOs opened (#8094 #8093 #8092 #8055 #8032 #8030 #8029 #8007 #8006 #8005 #8001 #8000 )

Printability

Tasks:

Modified scope to avoid working with additional libraries:-

  • [x] Using js script and DOM manipulations to create the print preview
  • [x] Set topics section display as None in the stylesheet.
  • [ ] Add better contrast to the links printed by changing the colour of a tag in the stylesheet.
  • [x] Images can be scaled down in the stylesheet for uniformity across the documents.
  • [x] Add css to display tables in proper tabular format
  • [x] Proper styling done with help of @ebarry
    //more points to be added here as and while developing if more improvements can be made

Documentation

Tasks:

8057 https://hackmd.io/@itm2017004/BJuqtap6L

  • [x] Creating a proper documentation guide covering all the points above ensuring that contributors abide by it to promote accessibility.
  • [x] The guide will contain sections for adding aria-labels,form-labels,alt text and testing 200% zoom on pages.
    //more points to be added here as and while developing if more improvements can be made

Up for discussion

Tasks:

  • [x] Running Lighthouse CI for pull request to ensure performance and accessibility in further code.More details can be found here. (Discussion issue here #8112 awaiting input)
  • [x] Replace will-paginate gem with pagy which is much more memory efficient and can improve performance.
  • [ ] Serving assets over HTTP/2 instead of HTTP/1.1
  • [ ] Add descriptive text for links for better Search Engine Optimization.
  • [ ] Add rel="noopener" to links having target=’_blank’ to allow safety of cross-origin destinations.
  • [ ] Allow password copy-pasting since it is flagged as not a secure policy by Lighthouse.
  • [ ] Remove error logging into the console in the production environment.
  • [ ] The turbolinks gem is present in the gemfile but not used. So needs to be removed assuming we ran into some issue with it ?
outreachy planning summer-of-code

Most helpful comment

@jywarren @cesswairimu @ebarry Have got some edits into the tasklist :joy: still need to refine this more

Also wanted to share the results for the work done so far:-
Before:-

image

After:-
(on different routes depending on the assets they have/load)

image

image

All 24 comments

@jywarren @cesswairimu @SidharthBansal This is just an initial draft for the planning. Since all of the features to be implemented require rigorous testing I think it would be better for now to not make this a project :sweat_smile: . Please go through all of the tasks I have raised, I have tried to be as elaborate as possible and since these are a not bugs, its entirely upon us if we want to implement it this way or not.

Also since most of these are tasks that would be better tested in the production environment, I will seek your constant support upon merging these to help me test it out :100:

I was also wondering if it is possible for me to start working on them right away since I want to make the most out of it :smile: without breaking anything xD

There are also a couple of issues/questions that I have to discuss after going through the codebase :thought_balloon:
Thanks a lot!! :rocket:

Great breakdown...Thanks for opening this @Tlazypanda

Yes! Happy to see this.

Also just want to say I'm here to help with any of the steps. I <3 WebPerf!

@emilyashley Thanks! Will be sure to keep you in the loop :tada:

Awesome, there are so many things to cover up this Outreachy!
Which one are you targeting first?

This is looking great. Hoping to go through it for some suggestions today! I added a link to your proposal too!

@SidharthBansal I plan to start with Improving Performance first and have opened some issues for the same :sweat_smile: Thanks a lot for reviewing :100:

@jywarren Yeah thanks :v: I have opened some issues for the start as well where I have added more details for each issue :sweat_smile: And as always looking forward to your suggestions :rocket:

Awesome to see all this. It seems super well planned out. Perhaps we could pull in some of the PDF generation (in-browser vs. in-app) discussion from your proposal too?

There is some really amazing stuff here! Wow, esp. in the "Up for Discussion" section!

Another thought is that this planning issue (and perhaps a summary later on) could be used as a template to inform similar refinements to our other Rails projects!

Great work!!!

Oh, also -- you can also create a milestone for all this as the issues start to be broken out!

@jywarren Thanks :v: :smile:
Just have one more exam to go and then I will create the milestone :+1: .

Sure will try to add points about the pdf discussion here as well :sweat_smile: . And yeah Really looking forward to making this a template for other rails projects too :rocket:

Hi @Tlazypanda! Would you mind updating this issue briefly with your recent work/progress, just so it stays current? Thank you!!! Hope your exams went well :-)

For example https://github.com/publiclab/plots2/pull/7966 and https://github.com/publiclab/plots2/issues/7963 are AWESOME 🎉

Another way you can keep up to date is to also assign all your issues and PRs to a milestone. Then we can track there and you can do a little less manual updating of this issue! Thanks!

I see you have https://github.com/publiclab/plots2/milestone/27 so i linked this to it! 🎉

@jywarren Thanks for the tip :tada: Will update it in a day or two :sweat_smile:

Thanks for all the awesome work on this so far!

Hi @Tlazypanda i just noticed a route with pretty slow response time and you don't have to prioritize it at all but it was a little unusual and I recall seeing long wait times for it in the past -- posting a comment! It's not even a full page load, it's AJAX, so it should be faster. I wonder -- maybe it's to do with sending the emails? But that should be handled by ActiveJob asynchronously. Here, i'll look in Skylight to see what's up... https://oss.skylight.io/app/applications/GZDPChmcfm1Q/1591890000/6h/endpoints/CommentController%23create?responseType=js (nothing really jumps out but lots of "allocation time"??? however, indeed 4.2 seconds at the /fast/ end doesn't sound good...)

Anyways, this could be broken out into its own issue for analysis but i thought you might want to hear of a particular action on the site that needs your help! No rush at all, i love the work you're doing, and hope this is helpful!

Hey @jywarren I am planning to modify all the ORM queries that might be slow/repetitive as flagged by skylight so I will take this into consideration :smile: Thanks for letting me know :v: I am still learning about the ORM querying system in rails so might take some time to get back on this :sweat_smile:

Hi @Tlazypanda. maybe you could update the task list and check the tasks that you have completed

Ohh yes! I have been meaning to do that for a long time now :joy: Finally gotta get this done xD

@jywarren @cesswairimu @ebarry Have got some edits into the tasklist :joy: still need to refine this more

Also wanted to share the results for the work done so far:-
Before:-

image

After:-
(on different routes depending on the assets they have/load)

image

image

Wow look at this performance boost!!!!! 🤩🤩🤩🤩🤩🤩🤩🤩

Wow this is awesome 🎉

wow fantastic :rocket:

Hi @Tlazypanda this is super, by the way, i forgot to comment! I wonder now that a lot more things have been merged and published, if we get an even better score!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

keshavsethi picture keshavsethi  ·  3Comments

keshavsethi picture keshavsethi  ·  3Comments

divyabaid16 picture divyabaid16  ·  3Comments

grvsachdeva picture grvsachdeva  ·  3Comments

ebarry picture ebarry  ·  3Comments