Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10413 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16586 invoked by uid 1010); 13 Jun 2004 09:24:30 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 16502 invoked from network); 13 Jun 2004 09:24:29 -0000 Received: from unknown (HELO smtp-out3.xs4all.nl) (194.109.24.13) by pb1.pair.com with SMTP; 13 Jun 2004 09:24:29 -0000 Received: from php.net (hetty.xs4all.nl [80.126.21.70]) by smtp-out3.xs4all.nl (8.12.10/8.12.10) with ESMTP id i5D9OCTM084220; Sun, 13 Jun 2004 11:24:24 +0200 (CEST) Message-ID: <40CC1D3C.9070605@php.net> Date: Sun, 13 Jun 2004 11:24:12 +0200 User-Agent: Mozilla Thunderbird 0.5 (X11/20040306) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alexander Valyalkin CC: internals@lists.php.net References: In-Reply-To: X-Enigmail-Version: 0.83.2.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: crc32() improvements From: abies@php.net (Ard Biesheuvel) Alexander Valyalkin wrote: > 1) Automatic initialization of crc32tab[] at first call. > So, the file crc32.h with definition of this tab is not > nessesary any more now. First of all, crc32tab is no longer in the .text segment, so it will not be shared between forked processes, taking more memory space than necessary. Each process will have to initialise it as well, so the init loop will run more than once. Secondly, compiler optimisation is always more effective working on data known to be constant. So removing 'const' from cr32tab is likely to produce slower code. Also, you used long int instead of int, which means your code will break on 64-bit platforms. > 2) Speed is improved on large amount of data. I seriously doubt that, as the tight main loop of the function didn't change that much. Using 'register' won't help you here (Windows cl.exe officialy ignores it altogether, GCC is smart enough to figure it out for itself) > 3) Less source size. Current verison has near 6.5Kb length > (including crc32.h). My version has only 2.5Kb length. Yeah, you managed that. Well done. -- Ard