sympy / sympy_benchmarks

Some benchmarks of SymPy
14 stars 32 forks source link

benchmarks for ode #69

Open RituRajSingh878 opened 4 years ago

RituRajSingh878 commented 4 years ago

In the dsolve benchmarks, only one benchmark is present for now. I am trying to add dsolve benchmarks but I am a little bit confused that how should I start? So can someone help me? https://github.com/sympy/sympy_benchmarks/blob/7d0835a78de5c664168a2e35684e44913018d571/benchmarks/dsolve.py#L19

For the dsolve, I am thinking to add benchmarks for all the hints one by one like for factorable-

def _make_ode_factorable():
    # eq = (f(x)**2-4)*(f(x).diff(x)+f(x))
    params = (f, x)
    return Eq((f(x)**2-4)*(f(x).diff(x)+f(x)), 0), params

class dsolve_factorable:

    def setup(self):
        self.ode, self.params = _make_ode_factorable()

    def time_dsolve(self):
        f, x = self.params
        dsolve(self.ode, x)

So should I proceed like this? If yes, then I have a few questions- If I add a benchmark for, let's say factorable method, so for that (like above), I will have to add at least one(maybe only one) equation to test. If I will add only one equation, then how we can say about slowing or speeding of a method based on only one equation. And If we will add more than one equations to test, then maybe it can be too slow to benchmark the method. If No, then how should I proceed? CC @oscarbenjamin

oscarbenjamin commented 4 years ago

As a starting point we should benchmark dsolve itself rather than the individual hints. Then we can see if changing the hints used leads to speed up or slowdown.

For the examples to pick I would aim for relatively common cases and examples that can be particularly fast or slow rather than trying to cover everything like the tests do.