simple speed measurement in javascript