I am extremely new to Arduino and have very little experience with it so halft the time i just fumbling my way through. So, my actual question is, is it possible to make this code react any faster? To be completely honest i copy and pasted this and modified to do what i need which is to set out put to low when over 1000 rpm. To give a little information im reading the flywheel magnet of a small engine and a 3144-hall effect. So, one revolution equals one signal event. hear is the code.
Also, floating point divisions are much slower than integer divisions. You can change them to a single integer operation and make your loop way faster.
And, move the LED status change instructions next to the rpm calculation. The LED state does not change if the rpm stays the same (rpm is an invariant outside the interval check).
Then you decided to copy the wrong program if you want really fast reaction! Your code is counting revolutions and making a calculation.
If fast response is required, measure the time between two pulses and when the time is equal to greater than 1,000 rpm, make your move! Any single motor revolution will be able to trigger your test.
As @Paul_KD7HB says you are counting revolutions in 1 sec and then you turn on/off the led.
This is not very 'responsive' as it will take 'around 1 sec' to visualize the speed variations.
The proposed solution ( counting the period between two pulses ) is the 'fastest', but consider that around the trigger frequency the led will flicker a little, which is good, for a led, but not if you intend to use this output to drive a relay, a load ( in this case the flickering is not good at all ).
P.S. also consider that having only one pulse x revolution you vill have only 20 count each second at 1200rpm, and every count is +/-60rpm ( you considered 30 in your code ), if you need more resolution use more pulses x revolution.