>>1246194The design of the A330 and A340 was carried out simultaneously (the main idea was to keep the two aircraft as similar as possible throughout development so that they might be considered for the same type rating). Development for both the A330 and A340 followed shortly after that of the A320 and was intended to take the same systems developed for the A320. Development started sometime in the late 1980s, after the completion of the A320.
The A340 made its first flight in 1991 and completed its certification rather quickly. The A330 first flew in 1992 and made use of a lot of the certification work the A340 had already done thanks to several parts being identical between the two aircraft.
The Boeing 777 first flew in 1994, and went into development slightly later than the Airbus, with the inital 777 design being a stretched version of the 767 until it became clear that a new design was necessary.
As a result, the A340 didn't have a competitor for 3 years, not unless you count the 767, which at the time was not ETOPS rated.
Efficiency was not the major concern at the time, especially since the early A340 aircraft used CFM-56, as an attempt to have 4 weaker and less fuel hungry engines on such a large aircraft. The same CFM-56 was already in use by the A320, the 737 and the Douglas DC-8-70. The same engine is also used on the Stratotanker, which is a military version of the 707, but with higher bypass engines and a focus on tanker operations.
It was only later with the A340-500 and -600 models that Airbus switched to much higher bypass Trent 500 engines, which were slightly smaller versions of the Trent 700 which was in use by the Boeing 777 (alongside the General Electric GE90 and the Pratt and Whitney offering).