+13
Progress - 75%

Optimization for performance

lefaek 4 years ago updated by Andrei S. (Developer) 8 months ago 22

ToDo

- caching system (save complex queries in transients and automatically flush them on dependent data instances have been changed)

- optimize scripts and styles and load them optionally on selected pages (Swiper, ECharts, Datatables, FlatPicker Calendar)

- image optimization (logos and player photos) - can be used 3d party plugins

- LIVE performance improvements

- load some content later by ajax (in hidden tabs, in hidden slides, in the list of games)

- image optimization plugin (in progress) - reduce small logos to 50*50 with tinypng API

- optimize DB structure (PRO version - player stats) to reduce the size and improve performance: maybe create statistic columns dynamically on save config

====

--- Original post ---

This script is amazing but too heavy. It could be lighter. Some tips for speed are:

1. All of anwp scripts and css loads in every page even not used. I use asset clean up and unload scripts that are not used in every pages. You can unload js/css by page/post or by post type ex. From all matches/clubs/etc pages.

I find what some js do. Echarts is for charts of course, easytimer is for livescore, datatables for player stats. But I don't know what propper/polyfilled/modal/airbnb does.

2. The script loads the original club image which is 150x150px (api import) and about 30kb. Is it possible to select to use the thumb of that image because now each of my pages has 1-1.5 mb just for club images


+4
Under review

What about a special Settings page with the possibility to enable/disable scripts/styles.

Maybe a solution like on the screenshot below will be cool?

Image 2659

Hi Andrei, 

I had the same problem, kindly help me how to get into this setting page. Thank you

that would be great. Similar to asset clean up. But also include some info for what each JS does/used in. So we know where to disable

Planned

--

Best Regards

Andrei S.

+2

v0.13.7 - Swiper (slider) and ECharts (charts) scripts are loading only on pages where needed

+1

v0.14.0

- loading scripts (Justified gallery + Featherlight) - only on required pages; 

- removed OverlayScrollbars

- optimized and removed unused CSS styles (main CSS file size is reduced appr. 300%)

- removed IE support (CSS styles and some scripts)

since v0.14.0 

- image lazy loading plugins work properly with team logos and player photos. Now they use <img> tag, before - background image.

Андрей, приветствую! Планируются ли еще какие то работы по оптимизации для ускорения процессов? Все еще наблюдается тяжесть загрузки страниц, хотя сделано не мало. 


Было бы здорово дотянуть до показателей 70+.
Заранее благодарен за ответ.

Progress - 50%

--

Best Regards

Andrei S.

+3

v0.14.8

- loading scripts (DataTables + Flatpickr) - only on required pages;


v0.14.8

- added optimized Swiper library (twice smaller). If you have a problem with it, disable it in FL+ Customizer


v0.14.10

- LIVE Import - changed import logic and rewritten code for better performance


v0.14.11

- img tag: added loading="lazy" attribute and width and height attributes

When will you do the DB optimization?

Later. 

It is a bit tricky and risky because it requires database manipulation. 

Maybe it will be a special plugin for advanced users.

--

Best Regards

Andrei S.

+3

v0.15.0

- JavaScript files have been rewritten in order to remove the jQuery dependency (frontend only)

- load scripts only on required pages (Plyr)

- changed game kickoff flipped countdown to a simple one (removed old jQuery script)

+5

Working hard on a new version 0.16.0 with performance and database improvements.

Most "postmeta" data will be transferred to dedicated tables. 

Player statistics will be moved to dynamically created columns in "anwpfl_players" table. 

This will reduce the database, improve query performance and API saving.

- removed duplicated fields for games and players from postmeta table (less db size)

- created a new "anwpfl_player_data" table with the most common player fields (better performance in query JOINs, less db size)

- (PRO) player statistics moved into "anwpfl_players" table, "anwpfl_player_stats" table will be removed after migration (less db size for 100%-300%, good performance for rendering shortcode based on player statistics)

- (PRO) moved prediction from "postmeta" to a new "predictions" table  (less db size, better performance on API save)

- (PRO) moved formations data from "postmeta" to a new "formations" table (less db size, better performance on API save)

- (PRO) moved transfers from "postmeta" to a new "transfers" table (less db size, better performance on API save, improved query time and performance)

--

Best Regards

Andrei S.

Excellent. But will the database improvements impact the existing site? I currently have over 1,800 matches, 80 seasons and nearly 700 registered players on my ANWP-powered website, and the thought of having to redo everything is a bit intimidating, to say the least! 😅

+4

It will have a special migration tool. I'll publish a tutorial before releasing that update.

--

Best Regards

Andrei S.

Nice!!!

There will also be tables for clubs, teams, stadiums, referees?

+5

Yes, but not in v0.16.0. I plan to do it later.

Primarily, I decided to improve the most problematic database tables.

--

Best Regards

Andrei S.