Encoder with Clickinterval

Hello, I am trying to get this program to work using Clickinterval, so when I spin the encoder faster it changes the dataref in X Plane faster.
I can get the encoder to work perfectly but I can't get it to spin faster when I turn the encoder faster. Turning it slow is fine. Here is my program if anyone who is familiar with this help me out?

 #include <Encoder.h>

Encoder IasEncoder = Encoder(1,2);

int countIas = 0;
int IasEncoder_prev = 0;
int IasEncoderVal = 0;

FlightSimCommand IasUP;
FlightSimCommand IasDN;


elapsedMillis IASEncoderClickInterval = 0;




void setup() {
// put your setup code here, to run once:

pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);


IasUP = XPlaneRef("1-sim/comm/AP/spdUP");
IasDN = XPlaneRef("1-sim/comm/AP/spdDN");




}

void loop() {

FlightSim.update();





long IasEnc = IasEncoder.read();
if (IasEnc != IasEncoder_prev){
IasEncoderVal = (IasEnc - IasEncoder_prev);
if(IasEncoderVal == -1){
countIas++;
}
if(IasEncoderVal ==1){
countIas--;
}
IasEncoder_prev = IasEnc;

if(countIas==2){
IasDN.once();
countIas = 0;
}

if(countIas ==-2){
IasUP.once();
countIas = 0;
}

if(IASEncoderClickInterval > 30){
IasEncoderVal = IasEnc * .25;
}else{
IasEncoderVal = IasEnc * 5.0;
IASEncoderClickInterval = 0;
}

}

}

If you're going to spin the encoder insanely fast, you need to use interrupts, so you need to connect to two external interrupt pins on whichever Arduino you have (you didn't say). Read all about it in the library documentation and example programs.

I see no suggestion that the use of interrupts would speed the code in any way. Common mistake.

The problem is with all the functions called on every pass of the loop. They are slowing it down.

I do note a critical mistake - using float operations. Should be:

IasEncoderVal = IasEnc >> 2;
}else{
IasEncoderVal = IasEnc + (IasEnc << 2);

Thanks Paul, I'll swap that out and try it!