Code running too slow on Mega ADK

I’m working on a bionic arm using servos and 2.5 inch flex sensors interfaced to an Arduino Mega ADK board.
The code is running very slow, it’s just over 4KB compiled and there is no delay() anywhere too. I don’t know what I’m doing wrong, if I’m using the wrong set of pins, syntax errors or something like that. The servos move after 1-2s delay and sometimes, even if the flex sensor is bent, the servo doesn’t move.

#include <Servo.h>

Servo servo1, servo2, servo3, servo4, servo5;

int servopin1 = 2;
int servopin2 = 3;
int servopin3 = 4;
int servopin4 = 5;
int servopin5 = 6;

void setup() {

void loop()
int Flex1 = analogRead(A0);
int Flex2 = analogRead(A1);
int Flex3 = analogRead(A2);
int Flex4 = analogRead(A3);
int Flex5 = analogRead(A4);

Flex1 = map(Flex1, 120, 308, 0, 180);
Flex1 = constrain(Flex1, 0, 180);
Flex2 = map(Flex2, 120, 308, 0, 180);
Flex2 = constrain(Flex2, 0, 180);
Flex3 = map(Flex3, 120, 308, 0, 180);
Flex3 = constrain(Flex3, 0, 180);
Flex4 = map(Flex4, 120, 308, 0, 180);
Flex4 = constrain(Flex4, 0, 180);
Flex5 = map(Flex5, 120, 308, 0, 180);
Flex5 = constrain(Flex5, 0, 180);


What do you mean by "The code is running very slow"?

How are the servos powered?

The servos doen't move as soon as the corresponding flex sensors are bent, takes a second or two to react.

I use a separate battery to power the servos and the Mega is powered via USB.

I see nothing about that code that would make it slow. I suspect, therefore that your force sensors are what are slow to react.

Put Serial.print() statements in your code to figure what is taking the time.