Super High Performance Pin I/O Technique

@ bobo1234
I've explored this also and the macros are not a good solution. They will only make the I/O faster for pin numbers known at compile-time. For pin numbers stored in variables it may be even slower than digitalRead/Write.
It is discussed for long time also here:
https://code.google.com/p/arduino/issues/detail?id=140
and worked out to probably its best in the Wiring implementation of its digital I/O (http://wiring.org.co/)

I believe better option is "encoding" the port address into input parameter of the digitalRead/Write functions. This gives the same speed as macros for compile-time constant pins (cbi/sbi instruction) but is also pretty fast for variable pins. Plus it is easily portable.
I worked out this solution for Arduino Uno and Mega here:
http://www.codeproject.com/Articles/732646/Fast-digital-I-O-for-Arduino

Just FYI: on ATmega2560 (Arduino Mega) some ports are outside the cbi/sbi range and the interrupts need to be disabled.