Please post your sketch so that we can see how you deal with the incoming Serial data
Are you by any chance using a function such as Serial.readString() that only terminates after a timeout occurs, and how is the Serial data terminated, if at all ?
The PC application opens up the serial port, which reboots the arduino and it takes some time before the setup() is reached and the Serial.begin() is executed and the connexion between the PC app and the arduino can proceed.
I've seen 2s, 5s seems large
but once the connection is established, then indeed there is no lag anymore (well only the baud rate and what the app is doing)
What? Openning the com port on the PC resets the arduino! I had not even noticed that...
But that would explain what I am seeing...
This is actually problematic for me! Is there a way to change this behavior?
Or is there some type of secret handshake in the bootloader to tell it to imediately drop to the main program?
getting rid of the boatloader altogether and using ISP to load your code will ensure the boot loader is gone and thus when you boot, it's your code taking control right away (well Arduino's main() function which performs the board's init)
If your question has been answered to your satisfaction, please mark the thread as solved so that other members that wish to help will not waste their time opening and reading the thread only to find that you no longer require assistance.