Generation is algorithm-specific: a random scalar and one point multiplication for elliptic curves (microseconds), a random seed for Ed25519 or ML-DSA, and a search for two large primes for RSA, which takes about 26 ms on average for 2048 bits and about 250 ms for 4096 bits on one Apple M4 Max core with OpenSSL 3.6.5, with wide variance. All of them need a cryptographically secure random number generator; a weak one produces weak or duplicate keys.
Good practice: generate keys where they will be used (inside the HSM, the Secure Enclave or the server) instead of copying them; record algorithm and purpose with the key (JWK alg and use, X.509 key usage); use one key pair per purpose (SP 800-57 Part 1 §5.2); and plan rotation from day one.
To check that a certificate, CSR or JWK belongs to a given private key, compare public keys, not file names: the key–certificate matcher does this locally.