if structure takes too much time

Maybe you're printing too much, and the stalling due to buffering of characters is causing you to wait too much.

Tell us about your wiring. Show us a schematic.