Skip to content
  • Jean Boussier's avatar
    1f9b7921
    macOS: Use GMP from homebrew · 1f9b7921
    Jean Boussier authored
    MRI's BigInt use GMP under the hood if available, and if not
    fallbacks to an homemade implementation with much worse performance.
    
    Without GMP:
    ```
    >> Benchmark.realtime { Integer('1' * (10 ** 7)) }
    => 13.80743500002427
    ```
    
    With GMP
    ```
    >> Benchmark.realtime { Integer('1' * (10 ** 7)) }
    => 0.4098639999865554
    ```
    
    macOS not being a common production platform, it's not a huge deal
    but it would still preferable to compile with `gmp.h` if present.
    
    I'd also suggest to print a warning if compiling on macOS and gmp
    isn't installed, but I don't know if it's desirable.
    
    NB: `--with-gmp-dir` was only added recently, so this will only
    apply to MRI >= 3.2, as well as rubies on which this flag was backported.
    1f9b7921
    macOS: Use GMP from homebrew
    Jean Boussier authored
    MRI's BigInt use GMP under the hood if available, and if not
    fallbacks to an homemade implementation with much worse performance.
    
    Without GMP:
    ```
    >> Benchmark.realtime { Integer('1' * (10 ** 7)) }
    => 13.80743500002427
    ```
    
    With GMP
    ```
    >> Benchmark.realtime { Integer('1' * (10 ** 7)) }
    => 0.4098639999865554
    ```
    
    macOS not being a common production platform, it's not a huge deal
    but it would still preferable to compile with `gmp.h` if present.
    
    I'd also suggest to print a warning if compiling on macOS and gmp
    isn't installed, but I don't know if it's desirable.
    
    NB: `--with-gmp-dir` was only added recently, so this will only
    apply to MRI >= 3.2, as well as rubies on which this flag was backported.
Loading