During a race/long run i'd pretty much always walk these days (well maybe not a 5k/10k), when i did the Grizedale marathon it really hit home when after about the first half a mile we came to a fairly steep hill and virtually everyone in front of me was walking up. Historically i'd always run up something like that so early in a race but it highlighted that it's a much better strategy to just walk up because of how tiring hills are when trying to run up them.
Sometimes i'll try and attack it to build strength/stamina but it's not really the best idea due to how fatiguing it is.
This is a TED talk by a huge advocate of the 80/20 rule and at around 4:20, he talks about being out for a run, when he sees an elite runner get to the bottom of a hill and walk rather than try and run up it.
https://www.ted.com/talks/stephen_s..._train_like_the_worlds_best_edurance_athletes
I also remember listening to a podcast with some ultra runners where he talked about how he always tried running up hills (and i'm talking really steep ones here), and yet once he changed strategy to "hike" up the hills he actually found he was overtaking some people trying to run whilst using less effort as it's just a much more efficient method of ascent.