How can I exactly put my sensor at 4 Hz readings?
The difference between your first code and the second one is that the first one is blocking execution when it reaches the delay function, but the second code keeps running without being blocked.

Now your algorithm has a drawback, the loop may or may not reach the if condition exactly when the modulo is strictly equal to 0. So you may prefer to use something like :

unsigned long T = millis();

...

if( millis() - T &gt;= 250 ) {
    ... // sensor stuff
    T = millis();
}


This idea is also presented in this article https://www.arduino.cc/en/Tutorial/BlinkWithoutDelay.

Another approach is to use Timers and Interrupts, but this is far more complicated (http://playground.arduino.cc/Code/Timer1).