Index into data before comparing it
Replace duplicated code with Attribute::sizeInBytes()