Optimize symbol name comparison.

Compare rawnames before comparing names. The call to `name`
incurs a phase check to determine whether the flattened names
should be used.