Mail cannot be sent instantly, ever.
The time taken by the mail() function bears no relationship to the time the mail takes to send. All mail() does, on Windows OR Unix, is submit the message to a queue, where the MTA then handles it as normal.
If the MTA is busy doing something else, or if the target server is not available, then the mail may be delayed indefinitely, up to some maximum defined by the MTA, after which it will bounce. This is usually at least a few days.
Even after a message has been accepted by the remote SMTP server, there's no guarantee that it won't be queued indefinitely there, before being delivered to a mailbox.
Mark