PERF Regression in HistGradientBoostingClassifier with cython 3

Related to https://github.com/scikit-learn/scikit-learn/issues/27086 but specialized to the regression observed in `HistGradientBoostingClassifier` for better tracking.

With cython 3, it looks that the speed of 2 parts has changed.
- the initial binning is faster, which is a good thing
- the computation of the histograms at each iteration is slower which is a bad thing.

Here's a profiling that clearly shows that the method `HistogramBuilder.compute_histograms_brute` is a lot slower than it used to be

**cython 0.29.36**
![prof_hgbt_cy2](https://github.com/scikit-learn/scikit-learn/assets/34657725/c2785724-52fc-4060-8a16-ec0a57e4f46c)

**cython 3.0.2 master**
![prof_hgbt_cy3](https://github.com/scikit-learn/scikit-learn/assets/34657725/9828cf43-7859-4653-a2bd-f618d9422326)

Looking at the cython annotated version of this function I can see that the generated code is different in both cases (~50% more lines of code with cython 3) but I've no clue how to interpret it. Below is the annotated version just for the `def` part of the following method
![Screenshot 2023-09-20 at 16-12-06 Cython histogram pyx](https://github.com/scikit-learn/scikit-learn/assets/34657725/da1495fd-fe7a-40de-b591-2d58549b2121)

**cython 0.29.36**
![Screenshot 2023-09-20 at 16-07-50 Cython histogram 2 pyx](https://github.com/scikit-learn/scikit-learn/assets/34657725/989c80dd-95f9-40e1-b8d7-efa3d69bc96a)

**cython 3.0.2 master**
![Screenshot 2023-09-20 at 16-08-47 Cython histogram 3 pyx](https://github.com/scikit-learn/scikit-learn/assets/34657725/1dd6b58c-3444-4d70-855e-04cb58ee333c)

I did not find any difference in the body of the method.

Ping @da-woods in case you have some time to take a look :)

COMMENT:
I'm struggling to reproduce a performance difference. I'm running

```
import numpy as np
from histogram import _build_histogram, HistogramBuilder
import time

HISTOGRAM_DTYPE = np.dtype([
    ('sum_gradients', np.float64),  # sum of sample gradients in bin
    ('sum_hessians', np.float64),  # sum of sample hessians in bin
    ('count', np.uint32),  # number of samples in bin
])

rng = np.random.RandomState(42)
n_sub_samples = 1000000
n_samples = 10000000
n_bins = 256

binned_feature = rng.randint(0, n_bins - 1, size=(n_samples, 20), dtype=np.uint8)
binned_feature = np.asfortranarray(binned_feature)
sample_indices = rng.choice(
    np.arange(n_samples, dtype=np.uint32), n_sub_samples, replace=False
)
ordered_gradients = rng.randn(n_sub_samples).astype(np.float64)
ordered_hessians = rng.randn(n_sub_samples).astype(np.float64)

hist = np.zeros((1, n_bins), dtype=HISTOGRAM_DTYPE)
builder = HistogramBuilder(
            binned_feature,
            n_bins,
            ordered_gradients,
            ordered_hessians,
            True,
            4,  # nthreads
        )
t0 = time.time()
histograms = builder.compute_histograms_brute(sample_indices)
t1 = time.time()
print(t1-t0)
```

And I'm getting ~0.38s for Cython master, 3.02, and 0.29.x.

The one thing that may be significant - I took histogram.pyx out of scikit learn and just compiled it myself with `python3 cythonize.py -3if histogram.pyx` (copying a few definitions out of common.pyx). That was just for my convenience.  I added the following directives at the top of the file to match what I think your global build system does:

```
# cython: boundscheck=False
# cython: wraparound=False
# cython: initializedcheck=False
# cython: nonecheck=False
# cython: cdivision=True
```

So I think further hints would be useful.

Labels: Performance, Regression