digital output follows input

I have a digital input signal coming in on a pin, I have an output pin which should follow the input signal. Whats the best and fastest way to achieve this. I actually need to output the same signal on two output pins. I cant use interrupt as I have about 8 such inputs and there are only 6 interrupts. I am using the mega.

I have a digital input signal coming in on a pin

What is this I/P signal?

its a normal 5v signal coming in from external world, going up and down from time to time.

All you have to do is a digitalRead on the input pin, then do a digitalWrite on the output pin(s).
Or am I missing something?

Performance is critical in my app, i would anyway use registers to do the read writes.. what I was wondering is do i really need to use the cpu to do this, maybe there is a way to connect the the input and output and forget about it... that way my cpu is free to do other jobs.

doors666:
Performance is critical in my app, i would anyway use registers to do the read writes.. what I was wondering is do i really need to use the cpu to do this, maybe there is a way to connect the the input and output and forget about it... that way my cpu is free to do other jobs.

Yes that is what I was thinking.
Why not just connect the input with what ever you want to connect the output to?

cant hardwire the connections... should be programmable... depending upon certain conditions, i will connect input to output... under some other situations, that wont be the case.

Sorry I can’t understand what you are saying.

cant hardwire the connections

If you can wire something to an arduino board you can wire it to anything else.

should be programmable

That is not what you said before, what sort of program intervention do you want?

under some other situations, that wont be the case.

So why not connect the input to output using an analogue switch like a 74HC4066, that way you can simply switch the input to follow the output or not with a logic level from the arduino.