This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Relationship between turtle speed setting and actual speed is not documented
Type: enhancement Stage: resolved
Components: Demos and Tools, Documentation Versions: Python 3.5
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: docs@python Nosy List: BreamoreBoy, belopolsky, docs@python, eric.araujo, georg.brandl, gregorlingl, terry.reedy
Priority: normal Keywords:

Created on 2010-10-21 20:19 by belopolsky, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg119334 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-10-21 20:19
As Terry J. Reedy mentioned in his comment on issue 7061, turtle documentation is lacking information on how speed "codes" 0-10 translate into actual turtle speed.

Attached script measures the speed of the two primitive operations that form the basis of turtle functionality at various speed settings.  The results below show highly irregular pattern.  The columns are: the speed code, time to draw a 200 unit line, time to complete a 360 degrees turn and the ratio of the two times.


         0: 0.01 0.01 0.83
         1: 1.04 2.05 0.51
         2: 0.49 1.06 0.46
         3: 0.30 0.72 0.42
         4: 0.23 0.54 0.44
         5: 0.17 0.44 0.38
         6: 0.13 0.39 0.35
         7: 0.08 0.32 0.26
         8: 0.08 0.28 0.30
         9: 0.10 0.27 0.37
        10: 0.08 0.23 0.36


From the source code, it appears that the on-screen speed is controlled by the number of animation steps while each step takes approximately time controlled by the "delay" setting that defaults to 10 milliseconds.

The number of steps is determined by somewhat peculiar computations.  For a rotation by angle of a degrees at speed setting s, the number of steps is

       n = 2 + int(a / (3 * s))

and for drawing a line of length d,

       n = 1 +  int(d / (3 * 1.1**s * s))

I am not sure what was the reason for these choices, but I think it would be better if numeric speed code had a more direct relationship to the apparent speed.
msg220858 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-17 18:47
IIRC somebody has been working on the turtle code and/or docs recently, if I'm correct presumably they could pick this issue up?
msg243434 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-05-17 23:39
After looking at these results in relation to the qualitative 'speed' documentation, I cannot think of any any enhancement appropriate for turtle doc audience.  So I withdraw my request.
History
Date User Action Args
2022-04-11 14:57:07adminsetgithub: 54379
2015-05-17 23:39:03terry.reedysetstatus: open -> closed
type: enhancement
messages: + msg243434

resolution: works for me
stage: resolved
2014-06-17 19:13:20terry.reedysetversions: + Python 3.5, - Python 3.2
2014-06-17 18:47:34BreamoreBoysetnosy: + BreamoreBoy
messages: + msg220858
2010-10-21 20:19:55belopolskycreate