What is the easiest way to run some code each millisecond for a certain amount of time?

What do you want to do, "as many times as possible"? What are you trying to achieve? All things take some time, so if you do it repetitively, you are already doing it as many times as possible in a given time frame.