Efficiently detect sign-changes in python

前端 未结 7 1538
深忆病人
深忆病人 2020-11-29 20:28

I want to do exactly what this guy did:

Python - count sign changes

However I need to optimize it to run super fast. In brief I want to take a time series an

7条回答
  •  清歌不尽
    2020-11-29 21:01

    Do you want to time it? Or do you want to make it as fast as possible?

    Timing is easy. Run it a zillion times, stopwatch it, and divide by a zillion.

    To make it as fast as possible, what you need to do is find out what's taking time and that you could do in a better way. I use either 1) the random-pause technique, or 2) the single-step technique.

提交回复
热议问题