New submission from Alexander Belopolsky firstname.lastname@example.org:
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.
---------- assignee: docs@python components: Demos and Tools, Documentation messages: 119334 nosy: belopolsky, docs@python, eric.araujo, georg.brandl, gregorlingl, terry.reedy priority: normal severity: normal status: open title: Relationship between turtle speed setting and actual speed is not documented versions: Python 3.2
Mark Lawrence added the comment:
IIRC somebody has been working on the turtle code and/or docs recently, if I'm correct presumably they could pick this issue up?
---------- nosy: +BreamoreBoy
Terry J. Reedy added the comment:
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.
---------- resolution: -> works for me stage: -> resolved status: open -> closed type: -> enhancement