Minor performance enhancement

`list.empty()` runs in constant time; `list.size` can run in linear time.
`list.empty()` runs in constant time; `list.size` can run in linear time.

Sources:
http://www.cplusplus.com/reference/list/list/size/
http://www.cplusplus.com/reference/list/list/empty/