Tyres react differently on different tracks anyway, different weather and the cars themselves can have been set up quite a bit differently for the different tracks.
Thing is when it comes to Q3 you can compare because by and large you can tell when people have gone full out to go the fastest and everyone will be on 2-3 lap fastest possible times. Race wise, you won't necessarily have everyone on the same settings at any given time, fuel saving stints, engines turned up or down but ultimately they need to do X amount of laps as fast as possible.
There isn't that comparison in testing because the teams are setting goals for themselves. Two teams do a 15 lap run on the same tyres, one is 2seconds a lap slower, are they slower, or is one team testing a saving fuel engines turned down, last 15 laps of the race stint, and the other team is testing a last 15 lap, engine turned up, burning fuel stint.
Every decision later in the year about how much fuel they can use and when, if its best to sit back from that car and cruise and go faster later, or if its desparate to go maxed out and get past that guy infront or your race is over, in large part comes from these tests and seeing how the car reacts in various situations, so the more variation on stints the better as its more data. Knowing the car sucks under heavy fuel if you are trying to go fast or slow, if tyre deg is the same going maxed out or slow, then whats the point of going slow. Burning through fuel with higher engine settings might make more difference to lap time under a heavy fuel load than a low one, they'll only know that through testing all these situations out though.
Ultimately the mediums were slower than hards stuff, was without knowing what teams were doing on their runs so its all guesswork. The longer the run the better info you can guess because at least you know whatever they were doing had loads of fuel on board.
You could say Perez's time is rubbish because Hamilton was on a 10 lap run on harder tyres and not much slower, Perez could have had 20 laps of fuel on board, but only went out for 3 though
Ultimately Hamilton's time was good because it was a hard tyre and a 10 lap run, so we know for certain it wasn't the fastest tyre or the lowest fuel load... Perez's time, looks half decent, if he had loads of fuel on board, its a great time, almost no fuel, it actually seems a little slow vs the Hamilton time.
Its all about the goals, without knowing what the teams are trying to learn, the times mean very little.