It might be more than just optifine, the way you're describing your fps as "40 fps, then drops to 15 for no apparent reason" makes me think this. Possibly java related, or allocated memory? I'm not 100% sure what to tell you as far as optimal settings, I've been away from minecraft for about 9...