Wind will be the biggest difference. A headwind makes a lot of difference. And if you do the maths, it never actually balances out over the two directions.
Speed...well a 747 cruises at up to .87. Not sure about the 777 but I think it's about .02 slower. Most Airbus are slower still, and I think the 340 is around .81. The A380 is generally around .85. For what its worth, maximum speed in RVSM airspace is .90. Of the big airliners, only the 747 can go that fast, but the fuel burn is prohibitive. (As an aside, the aircraft actual limit is .92, but it takes maximum continuous thrust to achieve around .91 in level flight).
On the busy air routes the speeds tend to be affected by ATC issues, so that the 747s are running a bit slower than they would like, and the others a little faster. The .82-.85 range is most common. In rough figures, at altitude a mach difference of .01 will equate to a speed difference of about 6 knots, so over roughly 15 hours, a .03 difference will translate to around 30 minutes of advantage for the faster aircraft.
Other things to consider are ETOPs. The 747 is largely unrestricted by route choice, whereas a big twin (or even the 340), may need to fly a longer route to remain within fixed distances from a landing field. That's why the QF flight time to South Africa was about two hours faster than VOz...the rules didn't allow a 777 to go as far south.
Altitude affects cruise mach choice. If you are held below the planned altitude, you may slow up a bit to save some of the fuel. Some aircraft are more sensitive to others with regard to being stuck at the wrong altitude. If you need to go higher than planned, then it varies with type...the 747 may go a bit higher if you run a bit faster, whilst the 767 and 380 will generally give you a higher max alt a bit slower. Flying higher than the plan also includes a fuel burn penalty.
They wouldn't always travel at this speed though?
I thought there was a line margin where increase in speed doesn't make much difference.
Generally an aircraft is programmed to fly at a 'cost index'. Basically that's a trade off of fuel burn vs the time based costs, and it can vary as fuel prices fluctuate. But, the basic idea in any aircraft is that it will climb to its initial cruise altitude, then as it becomes lighter, the speed will slowly be reduced until it reaches the weight for the climb to the next altitude. Speed will be increased and the aircraft will then climb. At the new altitude the cycle will be repeated. So, in the 747, your initial cruise might be a .87, and it will then slowly reduce to .85...then you climb and do it again.
If you have a think about it, much of this explains why gaining time back after a delay is next to impossible. Running faster than the plan costs fuel...ultimately lots of it. But, if I had enough, and ran about .02 faster than the plan from (say) Singapore to London, I'd save about 16 minutes. But, one run around the holding pattern will cost me 7 minutes...so, in general ATC will throw away any saving you have made. Plus, of course, the fuel required to go that fast, for that long, will almost certainly eat all of your reserves. It's easy (within limits) to lose time, but almost impossible to get a reasonable amount back. On a short sector, say Melbourne to Sydney, it's a waste to even try, but if you must, then the trick is normally to go quite low (about F280) at max mach number. Fuel burn is horrific, but it may make the difference between making a curfew or not.