I am developing a PHP application where large amounts of text needs to be stored in a MySQL database. Have come across PHP’s gzcompress and MySQL’s COMPRESS functions as possible ways of reducing the stored data size. What is the difference, if any, between these two functions? (My current thoughts are gzcompress seems more flexible in that it allows the
Tag: performance
Why php generator is slower than an array?
According to comments from documentation: http://php.net/manual/en/language.generators.overview.php We can see that thanks to generators there is huge memory usage improvement (which is obvious), but there is also 2-3 times slower execution – and that is not so obvious to me. We gain memory usage improvement at the expense of time – which is not fine. So, why is php generator slower
Adding collections/entities makes Form Rendering terrible slow
I’m using the Symfony2 Form Builder to make a form. All is working well, but the performance is terrible. A simple form (just a couple of text fields) is rendering in about 1000 ms, but with a entity or collection field it’s slowing down to about 7500-10000 ms. I’m using the query_builder (with createQueryBuilder()) option, like this example from the
in_array vs strpos for performance in php
I am logging in users via windows authentication and then storing that user’s rights in a session variable. I use a delimited method of rights storage in a database i.e: $rights //retrieved from …
What is the best way to read last lines (i.e. “tail”) from a file using PHP?
In my PHP application I need to read multiple lines starting from the end of many files (mostly logs). Sometimes I need only the last one, sometimes I need tens or hundreds. Basically, I want something as flexible as the Unix tail command. There are questions here about how to get the single last line from a file (but I
How to remove files after LOAD DATA INFILE?
I’m using the LOAD DATA INFILE solution to speed up big inserts, like outlined here: http://www.mysqlperformanceblog.com/2006/07/12/insert-into-select-performance-with-innodb-tables/. It works …
Fastest Way to Serve a File Using PHP
I’m trying to put together a function that receives a file path, identifies what it is, sets the appropriate headers, and serves it just like Apache would. The reason I am doing this is because I need to use PHP to process some information about the request before serving the file. Speed is critical virtual() isn’t an option Must work
Why is calling a function (such as strlen, count etc) on a referenced value so slow?
I’ve just found something very strange in PHP. If I pass in a variable to a function by reference, and then call a function on it, it’s incredibly slow. If you loop over the inner function call and the variable is large it can be many orders of magnitude slower than if the variable is passed by value. Example: This
Performance Improvement: Alternative for array_flip function
Is there any way I can avoid using array_flip to optimize performance. I am doing a select statement from database, preparing the query and executing it and storing data as an associative array in $…
How well does FFmpeg scale? Any examples?
I’m currently working on the server side of an augmented reality project. It’s a lot like http://www.livingsasquatch.com/. I’m using PHP/MySQL and FFmpeg to capture the webcam video and encoding it to .flv. Basically Flash uploads the video as a long series of .jpg images. PHP then takes those images, generates a few thumbnails and passes them through FFmpeg which converts