It sounds like you're looking for the solution which lets the chart calculate the fastest? I wouldn't use a calculated dimension or set analysis then. Consider doing something like this in the script instead:
LOAD ID ,origin ,destination ,if(origin=destination,ID) as ID_with_same_origin_and_destination ...
Then use the new ID field instead of the real ID field, and suppress nulls. I suspect that will be the fastest approach for the chart by a significant margin. Worth testing, in any case. Oh, and replace "ID" with whatever field you really wanted to play with if it isn't an ID. Same idea.