Install modified rasterstats from https://github.com/AsgerPetersen/python-rasterstats/tree/boundless to use this script as is.
Or just modify the bool in this line https://github.com/perrygeo/python-rasterstats/blob/master/src/rasterstats/io.py#L319
Script output:
❯ time python test.py
Using boundless: True
python test.py 72.11s user 9.82s system 99% cpu 1:21.96 total
❯ time python test.py
Using boundless: False
python test.py 1.51s user 0.24s system 90% cpu 1.926 total
I think the issue is emphasized for tiff files with a lot of tileoffsets. Probably because it takes releatively long time to open the file. This particular file is special in that it has a pretty large header but a small size on disk.