You need to set your computer to run at maximum while on power and a compromise when only on battery, to give you the most optimal speed for both.
Get a new battery, too. You don’t want problematic lithium batteries to stay lying around.
I had tried changing the battery setting from one end to other.
It had made no difference in speed. The new (and cheap, not from Dell, just some compatible item made in China) battery charger made the PC run fast again, without any other tweaking.