Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize the images #218

Open
xfq opened this issue Jun 28, 2020 · 6 comments
Open

Optimize the images #218

xfq opened this issue Jun 28, 2020 · 6 comments
Labels
jlreq-doc:enhancement [JLReq-doc] possible enhancement items on 2nd edition

Comments

@xfq
Copy link
Member

xfq commented Jun 28, 2020

It often takes tens of seconds to open jlreq, so IMHO it would be useful to improve the performance by:

  • Changing the image format to optimized WebP or SVG (using the picture element if needed), and/or
  • Adding the loading attribute to the img elements

since over 90% of the bytes downloaded are images.

@himorin
Copy link
Contributor

himorin commented Jun 29, 2020

I'm not sure whether we may have such configuration, but I think adding loading=lazy is the option. (with respec processed html file, "completed=7.04, DOMContentLoaded=5.70, load=7.05 sec" to "completed=2.17, DOMContentLoaded=1.65, load=1.79" on Firefox)

For image files, size of current English files is:

  • 8.7MB in png
  • 6.1MB in webp (default conversion option)
  • 4.8MB in png with optimized by optipng using default option

and I don't think we can get large improvement by changing the image format.

@xfq
Copy link
Member Author

xfq commented Jun 29, 2020

and I don't think we can get large improvement by changing the image format.

To me, this is already a lot of improvement (note that we have both English and Japanese images).

We should also see if (optimized) SVG is better (or at least not worse).

@r12a
Copy link
Contributor

r12a commented Jun 29, 2020

I ran ImageOptim on the first 10 files in my directory and reduced the size of all of them by around 50%. I'll run the others through that too.

@himorin
Copy link
Contributor

himorin commented Jun 29, 2020

We should also see if (optimized) SVG is better (or at least not worse).

In JL-TF, as in simple-ruby, we usually put outlined SVG image for those who don't have Japanese font. So size of image files could be larger than bitmap images.

@r12a
Copy link
Contributor

r12a commented Jun 29, 2020

Ok. I ran ImageOptim on all the images in /images and /images_ja. Both were around 8.2 Mb each to start with. Now they are 3.8 and 3.7 Mb respectively. Updated files have been committed to GH.

@kidayasuo
Copy link
Contributor

I believe adding loading=lazy would make it significantly faster. How about adding it before considering optimizing images? As we unified English and Japanese documents, we are loading twice as many images than actually needed. “loading=lazy” will mitigate that penalty. When #126 is fixed the option will make the amount of image load even smaller.

@xfq xfq mentioned this issue Feb 19, 2021
@himorin himorin added the jlreq-doc:enhancement [JLReq-doc] possible enhancement items on 2nd edition label May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jlreq-doc:enhancement [JLReq-doc] possible enhancement items on 2nd edition
Projects
None yet
Development

No branches or pull requests

4 participants