(sending again, forgot to CC the users list) On Mon, May 20, 2024 at 03:23:54PM +0000, T.D. Telford wrote: > With the csc compiler and the -f or -fixnum-arithmetic option (Assume all > numbers are fixnums) my benchmarks appear to be quite fast compared to racket > of chez scheme. When running a benchmark that uses big integers (such as the > pollard rho), execution times are almost twice as long as racket or chez.
Hello there! When we initially added bignum support in core (it used to be an egg), we spent quite a bit of effort optimizing various benchmarks, and on several of these (but not all of course), at the end CHICKEN performed *better* than several other Schemes, including Racket (which wasn't Chez-based at the time). It's quite possible that Chez Scheme has some optimized routines that other Schemes don't have, which we could learn from. If you have a specific benchmark that's slow, it would be helpful if you could share the code so we can have a look what it is exactly that slows things down. > Is there an egg or alternate code to improve the efficiency of big integers? > I would have thought there would be interface to gmp. While GMP is optimized to the hilt, it won't necessarily improve speed. The original "numbers" egg which provided add-on support for bignums was based on GMP and slow as molasses. Mediocre numeric code that's deeply integrated with the garbage collector and compilation strategy can easily outperform supremely bummed code that has to go through the FFI on every call. Again, if you can share some benchmarking code we can have a look if there are any obvious bottlenecks. Cheers, Peter