How to speed up data fitting and get percentile function
You seems to rewrite a well-optimized function of Numpy called np.quantile. Calling np.quantile(x, 0.05) provide the exact/accurate 5% quantile and is 4 times faster than your optimized implementation! Note that if you need to call this functions a lot of time on different independent arrays, then you can speed up the computation even more thanks to Numba parallelism.
I have a 1 dimensional array. I want to get a certain percentile(say,5%) of the fitting of this data(Monte Carlo method is best, guassian KDE method is also OK) as fast as possible. Because this function is used millions of times.
My way is using the scipy gaussian_kde.
My question is:

Any other ways to get higher speed of gaussian_kde?
Main cost is kde = gaussian_kde(x, bw_method=0.02) #about 220us