Yes, grouping by selector would be much better — it’s actually an optimisation that I’ve considered in the past. In the example, though, your final output would have to be something like

.pony, .lemur {
border: solid red 1px;
font-weight: normal;
}
.pony {
font-weight: bold;
}