When does boarding start?

I mean that some flights have all turnaround services done, but do not board. The flights could have left earlier, but they wait until the specified boarding time, which seems to be based off 1 minute per passenger prior to departure time.

For example, a medium flight in a smaller plane like an ATR will sit at the stand for an hour doing nothing because all turnaround services are done, but the flight boards 32 minutes prior to scheduled departure because there are only 32 passengers, all of whom have been sitting at the gate for that entire hour. The flight could have left early, but leaves very close do departure time and sometimes leaves late.

Large planes are the reverse as they leave early because their boarding times are much earlier. This A380 for example starts boarding as soon as the de boarding is done because it has so many passengers. Due to having more passengers than 300, the boarding is set to start before the flight lands. The flight is set to depart at 7:40, but boarding is scheduled to start 2 hours prior to the flight even arriving.

As a result, my smaller medium flights are late to depart sometimes while large flights leave an average of an hour early.