Why does correctly logging in take less time than an incorrect try?
It is not the actual password check that takes the time. An equality check (which is not what is done here) takes &lt;1 millisecond on a modern computer, so it's not something you can experience.

The delay is actually introduced by purpose by Apple programmers, so that an incorrect attempts results in this slight delay. It is an intentional delay which is purposefully inserted.

The reason for having the delay could be to alert the user that the password entered is incorrect, and to "pause for second" and try again with more precision. This way the user cannot quickly type lots of differents things, but will have to wait a bit between each attempt.