minor: optimize DEntity .keySet and .toMap