From your post, you seem to be interested in determining an 'instantaneous' velocity. I've supplied the definition which holds the key to your question. Given you have no form of feedback that does not require sampled data (counts), a processor and module with inherent delays (scan, data transfer), and the asynchronous timing between calculations and real data value at that instant, you will never have a true instantaneous speed. You can cut your time slice for comparing position counts and as with integration, come closer to an approximation of instantaneous speed as delta T (time) approaches "zero". Capture your delta between positions for a smaller time slice. You will eventually start getting some poor approximations of instantaneous speed when your time slice gets smaller than the inherent delays within your system. Arguably, a truer form of instantaneous speed capture would be a tachometer (analog voltage back to your speedometer reference).
Instantaneous velocity is the velocity of an object in motion at a specific point in time. This is determined similarly to average velocity, but we narrow the period of time so that it approaches zero. If an object has a standard velocity over a period of time, its average and instantaneous velocities may be the same.