I don't think it's possible to really optimize PC for Minecraft. It has tendency to lag even on very powerful computers. I'm talking about modpacks of cause. Vanila minecraft should be ok on your configuration. By the wat it uses most CPU and RAM. Myself I use about 6 gb for heavy modpacks.