# Why is ProbabilityDistribution 100x slower than ExtremeValueDistribution?

The two distributions are the same, except the ProbabilityDistribution cuts out below x=0. The wolfram documentation on ProbabilityDistribution says nothing about speed. A search of this site gave no obvious answer. Here is the code:

Dx = ExtremeValueDistribution[0.14068977685132567,
0.10712657717044427];
Dxp = ProbabilityDistribution[
E^(-E^(((-x + 0.14068977685132567)/0.10712657717044427)) + (-x +
0.14068977685132567)/0.10712657717044427)/
0.10712657717044427, {x, 0, Infinity}, Method -> "Normalize"];
AbsoluteTiming[RandomVariate[Dx, 10^6];]
AbsoluteTiming[RandomVariate[Dxp, 10^6];]

• Good question. I'd say that ProbabilityDistribution is a very general tool, so it needs a very general algorithm. I guess, when it is called with a generic function expression as firsts argument, it choses some rather general Monte-Carlo method. But if it detects one of the built-in distributions, such as ExtremeValueDistribution it can branch to a built-in algorithm that this tailored and optimized for this specific distribution. But maybe it is worth to report to Wolfram Research. Maybe they have overlooked some optimization potential in the generic branch... – Henrik Schumacher Jun 13 '18 at 18:05
• Thanks for your suggestion, I just asked Wolfram tech support about it. – Michael B. Heaney Jun 13 '18 at 18:58
• To generate random variates, the InverseCDF is needed. For the distribution Dx this is easily obtained: InverseCDF[Dx, q], For the distribution Dxp` numeric techniques must be used. – Bob Hanlon Jun 13 '18 at 19:10