All I did to get Minecraft running was just get a cheap graphics card. Of course, if you do think about getting one for this purpose, please do your research on whether it does or doesn't support the OpenGL Minecraft uses
I don’t use optifine tho I probably should. I’ve heard people say Java performance is bad but I’ve run it on a school laptop and been fine but I guess between Java and bedrock you are basically picking between lag or glitches