gh-35443: Fix slow doctests or mark # long time
### :books: Description
A test is supposed to take < 1s or else be marked # long time.
Here we consider slow tests taking >> 10s. When possible we fix or
change the test to take less time, otherwise we just mark the test as
long time. Occasionally we create a new smaller test and keep the
original one as long.
After this and #35442 the slowest tests are a few taking ~ 10s.
The total time to doctest all goes down from 880 to 806 seconds (using
`-tp 8 --all`).
~~NOTE: there's a minor merge conflict with #35314 which I will resolve
once that PR is merged.~~
### :memo: Checklist
- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
URL: https://github.com/sagemath/sage/pull/35443
Reported by: Gonzalo Tornaría
Reviewer(s): Gonzalo Tornaría, Matthias Köppe