Never ending testing ENVIRONMENT - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31) +--- Thread: Never ending testing ENVIRONMENT (/showthread.php?tid=73500) |
Never ending testing ENVIRONMENT - tony.a - 05-01-2019 Can we get rid of some 'ENVIRONMENT ' things in the core ? 24 +4 debugger Production means PRODUCTION so no more checking ENVIRONMENT inside core PHP Code: if (ENVIRONMENT !== 'testing') quote [b]ciadmin [/b] 'Spark is long dead. Check the date of the tutorials that mention it.' https://forum.codeigniter.com/thread-65106-post-331775.html#pid331775 no Spark check in production PHP Code: // Never run filters when running through Spark cli PHP Code: // $this->benchmark->stop('controller_constructor'); is_cli() is needed by my website ? NO but 17 is_cli() switch is performed checks PHP Code: if (is_cli() && ! (ENVIRONMENT === 'testing')) RE: Never ending testing ENVIRONMENT - dave friend - 05-01-2019 The reference to spark is not about the old package delivery system. It is about the custom CLI script that is part of CI4 https://codeigniter4.github.io/CodeIgniter4/cli/cli_commands.html There are many good reasons to run the framework from a command line ie. CRON jobs for one. RE: Never ending testing ENVIRONMENT - tony.a - 05-01-2019 Why whould you sacrifice 2-3-4-5-x years x 365 days of PRODUCTION website for 2 minutes usage of spark or cli commands ? Add a subdomain and do it from there . production means PRODUCTION with capital P. And lightning fast P ! Quote admin "You could always use a subdomain, eg http://www.yoursite.com and admin.yoursite.com, if you want to keep them separate." Means : if you want admin app you have to load 50-80 admin routes for every front end request with nested folders , module .. etc .. We need a production version of ci4 where is no testing enviroment ,no developing , no spark no cli, and a developer (admin) version RE: Never ending testing ENVIRONMENT - kilishan - 05-01-2019 Any performance increases you would see if those were removed (which they won't be) would be unnoticeable. One very important reason to have things working form the command line is running tests. And the new sparks CLI tool will only getter better and help you develop/debug faster in the future. If your application is that speed critical in production, than I'm sure you've got opcache turned on, and are using multiple layers of caching as appropriate throughout the application, which will make many of those checks you're concerned about not ran anyway. RE: Never ending testing ENVIRONMENT - tony.a - 05-01-2019 Removing all references to cli and ENVIRONMENT switch we have a gain of 40 - 100 ms /request no opcache . RE: Never ending testing ENVIRONMENT - kilishan - 05-01-2019 (05-01-2019, 10:38 AM)tony.a Wrote: Removing all references to cli and ENVIRONMENT switch we have a gain of 40 - 100 ms /request no opcache . Perhaps. But if you're running production without opcache you're making a mistake. Besides, you can't run something once and get a valid statistic. Additionally, the loss of features in the framework isn't worth it. Sorry. Some of those are there to provide CLI tools usage, and some are there we can test it, which we won't give up. And finally - any production server hardware should way outperform the numbers you're showing there. And lots of variables like the server you're running under (Apache has never been the speediest, for example), the configuration of the server, etc. For example, running locally on my 2015 Macbook Pro with the built in PHP server I see a total time for a raw install of 7-11ms. Every decent server I've hosted on in the last couple of years would easily outperform this. So, while those aren't going away, we're always open to optimizations that don't come at the expense of the framework itself. RE: Never ending testing ENVIRONMENT - tony.a - 05-07-2019 I mean 30% of routing time(no opcache) is switching Enviroment and checking if is cli . Imagine yourself a big boys script (facebook,etc ) checking 17 times (if Enviroment == testing) in production website . For those coming from another script might seems odd ! RE: Never ending testing ENVIRONMENT - tony.a - 05-07-2019 At least a branch where there is none of those |