A basic prompt like “is this code performant?” would probably catch this problem with current models.