Post by MaxD » Tue Jun 08, 2021 6:29 am

Hello, everyone! The long time have passed since I posted here.

I have created OpenCart distribution I'd like to share, that includes awesome performance changes and works with any PHP from 5.4 and higher.
It was really sad to see as PHP requirements raise enormously with each minor update (

I will be glad to hear your feedback.

Link to download - https://opencart.download/
Frontend demo - https://demo.opencart.download/
Backend demo - https://demo.opencart.download/admin/

Here is more detailed description:

About this distribution
This is official OpenCart 3.0.3.7 with PHP 5.4 to PHP 8 support, simplified install, improved performance (two times faster) and long-awaited fixes. It retains full compatibility with all OpenCart extensions.

Performance Tuned
  • Optimized TWIG engine with speed comparable to old TPL approach, that may gain up to 70 ms with heavy template, also it is compatible with PHP 5.4
  • Optimized events system, up to 20 ms gain
  • Small performance fixes
For the test two fresh installations was taken - this one and official OpenCart. Page generation time was measured (without compression and output). Tests show following results:
Homepage: 60 ms vs 140 ms
Admin Dashboard: 40 ms vs 70 ms

After that Journal 3 template was installed with demo data.
Journal 3 Homepage: 230 ms vs 520 ms

Simplified Installation
  • No need to rename config-dist.php
  • No need to delete install directory
  • No need to move storage folder
  • No need to rename .htaccess
Visual Changes
  • Button captions added to all buttons at admin (without template files modification)
  • Default theme look changed to be more contemporary (just with CSS edit)
  • .00 tail removed in prices for better readability (so $45.00 becomes $45)
Fixes
  • GZIP compression turned on for admin and frontend (do you know it doesn't work at all in official OpenCart 3.0.3.7?)
  • .htaccess files added to image and view/theme folders to impose proper compression and caching headers
  • robots.txt file fixed
  • index.php?route=common/home tail removed from homepage links
  • removed token warning at admin login screen
  • OCMod log is cleared on modifications refresh
Last edited by MaxD on Thu Jun 10, 2021 9:31 am, edited 2 times in total.

User avatar
Active Member

Posts

Joined
Fri Jul 06, 2012 6:37 pm


Post by EvolveWebHosting » Tue Jun 08, 2021 9:14 am

One question:
WHY would you spend time creating a version that works on outdated and slower PHP versions?

2 Week FREE Trial of our Shared Hosting plans (DIrectAdmin or cPanel) for new customers
2 Week FREE Trial of Astra Firewall and Malware Scanner
Visit our website for full details and to start your trial today - www.evolvewebhost.com


User avatar
Active Member

Posts

Joined
Fri Mar 27, 2015 11:13 pm
Location - Denver, Colorado, USA

Post by MaxD » Tue Jun 08, 2021 9:17 pm

It was not intentionally )

I just tried to speed-up OpenCart TWIG part and that lead to creation of TWIX (remastered TWIG engine that consists just of 2 .php files, thats why it's called TWIX). The side effect was that TWIX turned out to be PHP 5.4 compatible. OpenCart itself is PHP 5.4 compatible as well, that is TWIG engine that raised the bar up to PHP 7.4.

I admit that PHP 5 is slow and outdated. But it is quite annoying when I can not install Opencart without tricks at my localhost or VPS because it is PHP 7.2 there.

User avatar
Active Member

Posts

Joined
Fri Jul 06, 2012 6:37 pm


Post by EvolveWebHosting » Wed Jun 09, 2021 12:07 am

MaxD wrote:
Tue Jun 08, 2021 9:17 pm
It was not intentionally )

I just tried to speed-up OpenCart TWIG part and that lead to creation of TWIX (remastered TWIG engine that consists just of 2 .php files, thats why it's called TWIX). The side effect was that TWIX turned out to be PHP 5.4 compatible. OpenCart itself is PHP 5.4 compatible as well, that is TWIG engine that raised the bar up to PHP 7.4.

I admit that PHP 5 is slow and outdated. But it is quite annoying when I can not install Opencart without tricks at my localhost or VPS because it is PHP 7.2 there.
If you have a VPS, you should be able to install any available version of PHP. WHM for example, you can install up to 8.0

2 Week FREE Trial of our Shared Hosting plans (DIrectAdmin or cPanel) for new customers
2 Week FREE Trial of Astra Firewall and Malware Scanner
Visit our website for full details and to start your trial today - www.evolvewebhost.com


User avatar
Active Member

Posts

Joined
Fri Mar 27, 2015 11:13 pm
Location - Denver, Colorado, USA

Post by khnaz35 » Wed Jun 09, 2021 6:07 pm

MaxD wrote:
Tue Jun 08, 2021 6:29 am
Hello, everyone! The long time have passed since I posted here.

I have created OpenCart distribution I'd like to share, that includes awesome performance changes and works with any PHP from 5.4 and higher.
It was really sad to see as PHP requirements raise enormously with each minor update (

I will be glad to hear your feedback.

Link to download - https://opencart.download/
Frontend demo - https://demo.opencart.download/
Backend demo - https://demo.opencart.download/admin/

Here is more detailed description:

About this distribution
This is official OpenCart 3.0.3.7 with PHP 5.4 to PHP 8 support, simplified install, improved performance and long-awaited fixes. It retains full compatibility with all OpenCart extensions.

Performance Tuned
  • Optimized TWIG engine with speed comparable to old TPL approach, that may gain up to 70 ms with heavy template, also it is compatible with PHP 5.4
  • Optimized events system, up to 20 ms gain
  • Small performance fixes
Simplified Installation
  • No need to rename config-dist.php
  • No need to delete install directory
  • No need to move storage folder
  • No need to rename .htaccess
Visual Changes
  • Button captions added to all buttons at admin (without template files modification)
  • Default theme look changed to be more contemporary (just with CSS edit)
  • .00 tail removed in prices for better readability (so $45.00 becomes $45)
Fixes
  • GZIP compression turned on for admin and frontend (do you know it doesn't work at all in official OpenCart 3.0.3.7?)
  • .htaccess files added to image and view/theme folders to impose proper compression and caching headers
  • robots.txt file fixed
  • index.php?route=common/home tail removed from homepage links
  • removed token warning at admin login screen
  • OCMod log is cleared on modifications refresh
Welcome Back to Forum Max. Hope you are doing good during this challenging time.

Urgent Questions shoot here: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by JNeuhoff » Wed Jun 09, 2021 7:24 pm

Quite impressive what you did to Twig with your own Twix.

Just one small error in the developer settings, see attached screenshot, when enabling or disabling theme caching.

Attachments

screenshot-developer-settings.png

screenshot-developer-settings.png (22.2 KiB) Viewed 19594 times


Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by MaxD » Thu Jun 10, 2021 12:28 am

JNeuhoff, thank you for good words!
Everything is ok there, the error happens because that operation is not allowed in permissions. Any modification is prohibited for that demo account.

User avatar
Active Member

Posts

Joined
Fri Jul 06, 2012 6:37 pm


Post by MaxD » Thu Jun 10, 2021 9:33 am

I have added speed measurements results )

For the test two fresh installations was taken - this one and official OpenCart. Page generation time was measured (without compression and output). Tests show following results:
Homepage: 60 ms vs 140 ms
Admin Dashboard: 40 ms vs 70 ms

After that Journal 3 template was installed with demo data.
Journal 3 Homepage: 230 ms vs 520 ms

User avatar
Active Member

Posts

Joined
Fri Jul 06, 2012 6:37 pm


Post by khnaz35 » Fri Jun 11, 2021 1:02 am

Got a PHP warning:


2021-06-09 7:06:38 - PHP Notice: Array to string conversion in /home/u496403829/domains/demo.opencart.download/public_html/system/library/template/twix_compile.php(454) : eval()'d code on line 76

Urgent Questions shoot here: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by normdouglas » Fri Jun 11, 2021 11:34 am

This is very interesting and exciting
I'm about to try "upgrading" an existing sandboxed OC3 site.
Question... are there any DB mods as part of this release?

New member

Posts

Joined
Sat Apr 06, 2013 5:22 am
Location - Australia

Post by MaxD » Fri Jun 11, 2021 11:54 am

Nope, there is no any DB mods. To upgrade just overwrite all files except both config.php

User avatar
Active Member

Posts

Joined
Fri Jul 06, 2012 6:37 pm


Post by Paul.B » Thu Jun 17, 2021 1:01 am

When trying the Basel template.
[16-Jun-2021 16:59:13 UTC] PHP Parse error: syntax error, unexpected '-', expecting '{' in /home/XXXXXXXX/public_html/system/library/template/twix_compile.php(454) : eval()'d code on line 4
[16-Jun-2021 16:59:13 UTC] PHP Fatal error: Class 'basel_template_common_mobile-nav' not found in /home/XXXXXXXX/public_html/system/library/template/twix_compile.php on line 460

The above can be quick fixed with

Code: Select all

$cls = str_replace('-', '_', $cls);
Also in checkout:
<b>Notice</b>: Uninitialized string offset: 1 in <b>/home/XXXXXXXX/public_html/system/library/template/twix_compile.php(455) : eval()'d code</b> on line <b>419</b>
Last edited by Paul.B on Thu Jun 17, 2021 2:04 am, edited 1 time in total.

Newbie

Posts

Joined
Mon Jun 07, 2021 11:40 pm

Post by LVL91 » Thu Jun 17, 2021 2:04 am

Thank you very much for your contribution MaxD!
I had to test this myself and I am now starting to explore a few or your changes in the code. I compared the difference in processing time using hrtime around the changes you made in catalog\controller\event\language.php.
I modified this file with your changes with a if/else for the OC default code and your code. I also had to add the set_all() function for this in the language library.
Your simple, yet smart, changes seems to be an improvement of about 1000% for the changes (testing the home page). After a lot of tests on the same setup I measured a performance gain of about 3ms just for this simple change. The OC default code processes in as low as 3.4ms, while your code could process this in as little as 0.36ms. (please take note: the noted times are just for functions that have been changed in the file mentioned above)

I haven't even started using your "Twix" or any of the other changes, but I have to say I am impressed already...

New member

Posts

Joined
Fri Feb 21, 2014 9:12 am

Post by MaxD » Thu Jun 17, 2021 2:50 am

LVL91, glad to hear that! Also you might be interested in checking my events optimization, it is plain replacement of system/engine/event.php - and biggest performance gain.

Unfortunately, Twix doesn't work with some tricky templates, I am fixing the cases on reports.

User avatar
Active Member

Posts

Joined
Fri Jul 06, 2012 6:37 pm


Post by MaxD » Thu Jun 17, 2021 4:38 am

The above-mentioned issues are fixed and distribution updated.

User avatar
Active Member

Posts

Joined
Fri Jul 06, 2012 6:37 pm


Post by LVL91 » Thu Jun 17, 2021 6:11 am

MaxD wrote:
Thu Jun 17, 2021 2:50 am
LVL91, glad to hear that! Also you might be interested in checking my events optimization, it is plain replacement of system/engine/event.php - and biggest performance gain.

Unfortunately, Twix doesn't work with some tricky templates, I am fixing the cases on reports.
Well I did my testing again and you certainly didn't lie about this! I used hrtime again for this file at the beginning and the end:
catalog/controller/common/home.php
Just to check the total time it takes to generate everything. OC default needed a minimum of 260ms in this part of the code while your substitution of system/engine/event.php does the same in as low as 199ms, just below 200ms! That's basically a guarenteed 60ms increase for the homepage! (in my case at least)

Have you thought about releasing this as a separate OCMOD without the visual changes, but with just the performance-related parts?

New member

Posts

Joined
Fri Feb 21, 2014 9:12 am

Post by MaxD » Thu Jun 17, 2021 10:43 pm

LVL91, I don't know yet if I will post this as OCMod. Still waiting for some reaction from people if they need it at all )

Meanwhile all this optimizations are included into my OpenCart Lightning accelerator.

User avatar
Active Member

Posts

Joined
Fri Jul 06, 2012 6:37 pm


Post by khnaz35 » Thu Jun 17, 2021 11:00 pm

Well Max, I have downloaded this version and want to try but still couldn't got a chance yet.

Definitely love the idea for speed and performance specially with Journal 3 theme.

That's beast need to be beat for speed and performance.

Urgent Questions shoot here: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by Cue4cheap » Fri Jun 18, 2021 10:38 am

MaxD wrote:
Thu Jun 17, 2021 10:43 pm
LVL91, I don't know yet if I will post this as OCMod. Still waiting for some reaction from people if they need it at all )

Meanwhile all this optimizations are included into my OpenCart Lightning accelerator.
Would this be safe to try on OC 2.3.0.2 online store? (I don't normally do that but I just deleted all my test stores).
Mike

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by MaxD » Fri Jun 18, 2021 10:51 am

If that store is live with non-stop customers traffic I'd recommend checking at test site first. But it's safe in general.

User avatar
Active Member

Posts

Joined
Fri Jul 06, 2012 6:37 pm

Who is online

Users browsing this forum: nancyagarwaal and 96 guests