add fast variable span function based on reduceat