Is there an alternative? the procedural mesh component is incredibly slow.

I wanted to make voxels, but as it turned out, the problem is not in my code, but in the grid display itself. I need an alternative to the Procedural mesh that draws everything instantly.

You would need to convert procedural mesh to dynamic mesh

Enable the plugin Geometry Scripting and try “Copy Mesh to Static Mesh” which converts dynamic mesh to static mesh.
Then you can copy the dynamic mesh to a new static mesh which should be more performant.