Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: comp.lang.php Subject: Re: poor performance while processing a file one byte a time Date: Thu, 20 Jan 2022 20:27:32 +0100 Lines: 24 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: individual.net SgtrQG2mrsQ9xwmnfP+9yQwLSNc7WciYq12aU255aZKte6MTl5 Cancel-Lock: sha1:biERTFl1cD9eOXASpm5LVluqPe4= Content-Language: de-DE In-Reply-To: Xref: csiph.com comp.lang.php:18856 Mateusz Viste: > On Thu, 20 Jan 2022 19:23:49 +0100 > Arno Welzel wrote: [...] >> However this may still be quite slow on larger files. Since it seems >> you want to create some kind of checksum based on the file content, >> you may want to use something else like hash_file(), sha1_file() or >> md5_file() and use the result of these calls instead processing the >> whole file content in a loop. > > Sadly, that won't work. The kind of checksum I am computing is not > supported by PHP, hence why I do it byte by byte myself. Another > solution is to do it with my C code by system()-calling it from PHP, > but that's really ugly. At this point I'd rather stick with a slow, 100% > PHP solution. Or you create your own PHP extension which can then be used in the script ;-) -- Arno Welzel https://arnowelzel.de