Depends on what you mean by 'efficient'.
Are you trying for the best times? Are you racing? In a hurry?
Or are you trying to conserve energy?, or pace yourself?
Concerned about bonking?
Trying for the easiest or most pleasant approach?
Trying to make the most miles?
Just curious?
Or?
***
Also, it seems that it would also depend in part on the nature of the hills. If they are not too bad, it could be very good exercise to turn them into intervals.
The length of the trip would also factor in, and your fitness level.
***
If you sense a safety issue in going too fast on some of the downhills, it is probably not worth risking your life or your health to save a few minutes or seconds.
***
You can chart it. It tends to make things clearer. (When I did this, I was surprised by the time factor -- when you are going very slowly, the time factor really skews your average speeds and overall times.)(You can also try it several different ways, and time yourself. Many cyclocomputers, even the inexpensive ones, can also help in nailing it down; but you can also just time it....)