- jQuery's addClass(), 35 lines: https://github.com/jquery/jquery/blob/master/src/attributes/...
- Umbrella JS's addClass(), 5 lines: https://github.com/franciscop/umbrella/blob/master/src/plugi...
So the choice is either well-tested libraries that slows your users down so you'll lose a % of them, optimize the hell out of them so you'll "waste"* time, or use a smaller library which is a compromise between them you'll loose a tiny % of users who you don't support, but you have to invest some time to learn it.
It is not black and white, so luckily we have a choice here and different scenarios warrant for different libraries.
* I specify waste since it's probably something you already know and just have to do it; if you're learning it for the first time then it's not wasted at all