Like Photoshop does. Whatever slower it might be. With math method choice.
I always see some kind of square shaped kind of jpg like artifacts when I try to scale down a noisy looking bitmap in SD. Photoshop learned to do it perfectly well somehow while did had same issue with smart objects initially.
For scaling down at least , I understand that scaling things up could be some AI involved huge research task .