So I not so recently crossed a problem with any version of OptiFine. And by any version I mean the mirrored version, and the forge version, as well as multiple different versions of minecraft. The issue us that no matter what settings I use, the FPS caps out at 40 fps, wether or not i have mods and shaders on. I know many people are just going to say "vsync" but I can assure you it isn't vsync, as I have a 240hz monitor. I also have a high capability GPU and CPU; the rtx 260, and a core i7 9th gen. These can run normal java at 60 fps no problem. I'm not sure why but I also can't get java to run above 60 fps. Again this isn't the fault of vsync or my refresh rate, nor is it because my pc's capabilities. Something is bottle necking Java and OptiFine. I don't believe this is something I can fix by changing the settings in minecraft itself, I feel like I have to directly change my systems settings, but I can't figure out how to do that in nvidia control panel or nvidia game ready driver. And no I do not need to allocate more ram to Forge because I currently have it at 8 GB, which should be plenty even for heavy modding. Now that I consider it maybe allocating more to the vanilla release of minecraft could help fps but I doubt it. If you want proof that my system can run forge and optifine no problem take this into consideration; I am doing a modded playthrough right now with 11 mods, and SEUS shaders, and the FPS never once goes below 38, unless I go and blow up a ton of tnt. I am mostly mentioning this because, in a lot of forums I look at, they blame the persons pc specs and screen hz no matter what the person says. Also turning render distance down doesn't do anything at all. I tried messing with the game ready driver settings and that didn't do anything. Java has full access to my NVIDIA card and I am certain it isn't running only on integrated. I'll leave an image of the f3 menu open while in a heavily modded 1.15.2 world for you all to look at, maybe I'm missing some of the info it's displaying. And I also just realised this, the 40/39 fps? what does the 39 stand for I wonder. Either way I can't wind a way to change it.
(SOLVED) It was whisper mode in NVIDIA game ready driver. Turned it off and the fps ran at 45-ish. then I optimized the settings in game ready and it ran at 120 fps.