Going from 32mm to 40mm tires has a speed penalty.
You are living in the past; under most circumstances, the opposite is correct: narrow tires will incur a speed penalty (as well as being much less comfortable, meaning you are able to spend fewer hours each day riding).
Nowadays the argument is more about "wider tires aren't
always faster, they are just
usually faster":
https://efprocycling.com/tips-recipe...ke-you-faster/
https://www.bicycling.com/bikes-gear...-tires-slower/
https://www.bikeradar.com/advice/buy...-tyres-faster/