77% swift-performance-lite

Code Review | Swift Performance Lite

WordPress plugin Swift Performance Lite scored77%from 54 tests.

About plugin

  • Plugin page: swift-performance...
  • Plugin version: 2.3.6.15
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.2
  • WordPress version: 6.3.1
  • First release: Feb 6, 2018
  • Latest release: Nov 24, 2023
  • Number of updates: 87
  • Update frequency: every 24.3 days
  • Top authors: swte (100%)

Code review

54 tests

User reviews

119 reviews

Install metrics

10,000+ active /606,219 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲3.46MB] [CPU: ▲20.87ms] Passed 4 tests

Server-side resources used by Swift Performance Lite
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /6.85 ▲3.3870.85 ▲29.73
Dashboard /wp-admin6.77 ▲3.4771.77 ▲18.42
Posts /wp-admin/edit.php6.89 ▲3.5374.70 ▲25.55
Add New Post /wp-admin/post-new.php9.38 ▲3.49110.24 ▲9.76
Media Library /wp-admin/upload.php6.72 ▲3.4973.11 ▲37.26
Swift Performance /wp-admin/tools.php?page=swift-performance6.92122.00

Server storage [IO: ▲8.59MB] [DB: ▲0.02MB] 67% from 3 tests

A short overview of filesystem and database impact
Please fix the following
  • You have illegally modified 3 files (8.48KB) outside of "wp-content/plugins/swift-performance-lite/" and "wp-content/uploads/"
    • (new file) wp-content/mu-plugins/swift-performance-loader.php
    • (new file) .htaccess_swift_backup
    • (modified) .htaccess
Filesystem: 595 new files
Database: 1 new table, 11 new options
New tables
wp_swift_performance_warmup
New WordPress options
wp_swift_performance_db_version
swift_performance_options
swift_performance_autocomplete
swift_performance_messages
widget_recent-posts
db_upgraded
can_compress_scripts
widget_theysaidso_widget
category_children
theysaidso_admin_options
...

Browser metrics Passed 4 tests

An overview of browser requirements for Swift Performance Lite
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,900 ▲12814.39 ▲0.043.91 ▲1.8828.75 ▼17.61
Dashboard /wp-admin2,247 ▲705.64 ▲0.0097.05 ▲6.8685.67 ▲46.34
Posts /wp-admin/edit.php2,173 ▲732.11 ▲0.1238.82 ▼1.4941.86 ▲6.12
Add New Post /wp-admin/post-new.php1,562 ▲3622.96 ▼0.46699.90 ▲111.6358.98 ▲12.23
Media Library /wp-admin/upload.php1,477 ▲774.31 ▲0.07101.99 ▲6.6491.48 ▲51.28
Swift Performance /wp-admin/tools.php?page=swift-performance1,8612.6149.68110.25

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% from 4 tests

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • This plugin does not fully uninstall, leaving 8 options in the database
    • theysaidso_admin_options
    • swift_performance_autocomplete
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments
    • category_children

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 18× PHP files perform the action of outputting non-empty strings when accessed directly (only 10 are shown):
    • > /wp-content/plugins/swift-performance-lite/templates/whitelabel/image-optimizer.php
    • > /wp-content/plugins/swift-performance-lite/templates/dashboard.php
    • > /wp-content/plugins/swift-performance-lite/templates/image-optimizer.php
    • > /wp-content/plugins/swift-performance-lite/templates/whitelabel/dashboard.php
    • > /wp-content/plugins/swift-performance-lite/modules/cache/ajaxify.php
    • > /wp-content/plugins/swift-performance-lite/modules/image-optimizer/templates/modal.tpl.php
    • > /wp-content/plugins/swift-performance-lite/templates/whitelabel/header.php
    • > /wp-content/plugins/swift-performance-lite/templates/db-optimizer.php
    • > /wp-content/plugins/swift-performance-lite/templates/whitelabel/db-optimizer.php
    • > /wp-content/plugins/swift-performance-lite/modules/image-optimizer/templates/dashboard.tpl.php
  • 132× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/swift-performance-lite/modules/image-optimizer/image-table.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'Swift_Performance' not found in wp-content/plugins/swift-performance-lite/modules/cache/cache.php:2623
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/swift-performance-lite/includes/luv-framework/templates/tpl.number.php:1
    • > PHP Notice
      Undefined variable: classes in wp-content/plugins/swift-performance-lite/includes/luv-framework/templates/tpl.number.php on line 1
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/swift-performance-lite/includes/cache-status/cache-status.php on line 3
    • > PHP Warning
      implode(): Invalid arguments passed in wp-content/plugins/swift-performance-lite/includes/luv-framework/templates/tpl.switch.php on line 1
    • > PHP Notice
      Undefined variable: classes in wp-content/plugins/swift-performance-lite/templates/luv-framework/pro-only.php on line 1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/swift-performance-lite/includes/luv-framework/templates/tpl.sortable.php:1
    • > PHP Warning
      implode(): Invalid arguments passed in wp-content/plugins/swift-performance-lite/includes/luv-framework/templates/tpl.license.php on line 1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/swift-performance-lite/includes/classes/class.third-party.php:11

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
8 plugin tags: seo, speed, optimizer, cache, cdn...

swift-performance-lite/performance.php 85% from 13 tests

The main PHP script in "Swift Performance Lite" version 2.3.6.15 is automatically included on every request by WordPress
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("swift-performance-lite.php" instead of "performance.php")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Good job! No executable or dangerous file extensions detected90,835 lines of code in 457 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript1655,3113,77638,889
PHP902,6862,97019,003
HTML1282,527813,488
CSS681,7203289,191
SVG4006,243
PO File21,3871,7594,021

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.52
Average class complexity71.16
▷ Minimum class complexity1.00
▷ Maximum class complexity609.00
Average method complexity5.63
▷ Minimum method complexity1.00
▷ Maximum method complexity79.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes45
▷ Abstract classes24.44%
▷ Concrete classes4395.56%
▷ Final classes00.00%
Methods565
▷ Static methods24242.83%
▷ Public methods52292.39%
▷ Protected methods335.84%
▷ Private methods101.77%
Functions110
▷ Named functions109.09%
▷ Anonymous functions10090.91%
Constants77
▷ Global constants7293.51%
▷ Class constants56.49%
▷ Public constants5100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
11 PNG files occupy 1.21MB with 0.41MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/background.png1,026.50KB390.09KB▼ 62.00%
images/logo.png15.89KB9.68KB▼ 39.07%
images/known-pages.png1.31KB1.56KB0.00%
images/threads.png2.02KB1.70KB▼ 15.67%
images/logo-lite.png19.83KB9.70KB▼ 51.11%