shortest code for techometer using reed switch

thanx... and from this speed i want to drive a high torque servo motor which is connected to the gear shifter. so at regular speed interval gear shift can be achieved. so please provide me with an ultra responsive code which would perform this job perfectly. Assume every gear shift at 10 degree of servo rotation for every increment in speed of 5 km/hr