In China, you need to show your passport/identity card to buy the ticket, since free movement is restricted in this way. Therefore, they have to check when you board the train.
In Europe, Japan and Taiwan etc, it's a good idea to be there a few minutes before (especially if you're not familiar with the station), but it's always less time than required for getting on a plane.
Trains also are electric which is a plus.
You can get to the station 2 min before it leaves and jump in.