I’ve use a crude way of printing time stamps once and looked at their delta’s. They stayed within parts of a millisecond that time. That was OK for my use case.
User interaction can easily have an effect on timing if the code immediately responds to any changes. What I’m experimenting with is that I’m:
1: defering some of the actions that should take place to the start of the new loop and
2: quantising analog values to the number of values that are relevant. I’ve written a bit about a potentiometer class in some code snippets but since then I’ve made a quantised potentiometer class. This allows for choosing the number of values you want a potentiometer to have at max. So now I won’t get up to 1024 intermediary values that will take time to process but don’t change anything. Furthermode it is easier to check with the pot whether its value has changed and only if it has, then do something.
A nice side effect of 1 is, that my timing does not need to be perfect.