I would assume you are on windows. Go to windows defender settings and -add- a -folder- exemption for the entire /x-plane (make sure to add a /xplane folder not just file exemption)
Problem is when you make a change inflight, scripts are loaded and updated real time until you commit the change via the EXEC button on the FMC, under that time the defender analyzes the scripts and cpu goes to 100% killing the sim performance.