Using PETSc to solve Ax=rhs

Hello everyone,
I am trying to reduce the time for solving the system of linear equations: Ax=rhs.
My method is to use factorization provided by “pkg:LinearAlgebra”.
However, I know that if we can use PETSc it will be much faster for the large matrix.
Herein, I give a simple code for illustration by using factorization provided by “pkg:LinearAlgebra”.
Then, if you know how to use “PETSc” in Julia to modify these codes, could you please help me? I appreciate your help.
Thanks a lot.

using LinearAlgebra
n = 10000; # size of matrix
A = 100*rand(n,n); # matrix A
rhs = 5*rand(n); # Right hand side rhs
A_factorized = factorize(Symmetric(A)) # factorize
x = A_factorized\rhs; # Solve

for dense matrices like the one you posted, LinearAlgebra is likely to be optimal as long as you aren’t on a cluster. For large sparse matrices, you likely want to use LinearSolve.jl which, like PETSc, provides krylov methods as well as factorization based methods.

Dear Smith,
Thank you for your recommendation about using LinearSolve.jl.
Best regards,