Optimize ReferenceList::serialize

As suggested in https://github.com/wmde/WikibaseDataModel/pull/260#discussion_r19383265.