The problem is that the switching of the pins is too slow from the managed code.
I saw there is ParallelPort class in GHI.Premium.Hardware, but I couldn’t find any in GHI.OSHW.Hardware.
Is there any faster way for this (by using libraries and managed code) ?
Because the register write looks up the register address in a managed struct, it is quite slow. Meanwhile, OutputPort.Write is very fast; it calls a native function immediately that looks up the address at the HAL level (written in C++), and sets the pin state. If you’re coming from Arduino, you’re probably used to huge performance differences between register writes and the GPIO API. Not the case here. (Of course if you wrote directly to the register in C, the function would execute faster than the GPIO API).
You’re missing the point though. The real slowdown comes from the managed execution environment looking up all those method calls and chugging through them… If you’re trying to speed up your program with direct register writes and != for loops, you’re going to end up with a nasty-looking program that’s not measurably faster. Use interops! Or RLP! That’s what it’s there for.