Re: Speeding up builds

Olly Betts via Swig-user <[email protected]> Sat, 24 May 2025 23:29:17 +0100
Newsgroups gmane.comp.programming.swig
Message-ID <[email protected]>
On Fri, May 23, 2025 at 08:19:41AM -0500, Davis C. wrote:
> On Thu, May 22, 2025, 4:58 PM Olly Betts <[email protected]> wrote:
> 
> > My first suggestion would be to make sure you're using the latest
> > version in case this has already been addressed.
> 
> That was it. I was running version 4.0.1. On 4.3.1 it takes only 30 seconds
> for the same file. I should've thought to check that sooner.

I suspect this is thanks to an improvement in 4.1.0 to the hash function
used for SWIG's internal hash tables.

The old hash function only considered the last five characters plus the
least significant bit of the last-but-sixth character, which could
generate a lot of many-way collisions, especially for C++ code.  For
example, processing li_std_list_wrap.i from the testsuite for Python the
hash collision rate dropped from 39% to 0.

Cheers,
    Olly