Interesting question.
There's a bit of a flaw in your assumptions. The explosion that compressed the fissible material in an A bomb (and in an H-bomb, which is actually
initiated by an A-bomb) doesn't really enter into consideration. All it does is squeeze the uranium or plutonium together so that a chain reaction
can take place.
The energy released comes from the fact that the uranium nucleus splits into various daughter nuclei and a few neutrons (needed to continue the chain
reaction). I'll give you an example.
n stands for neutron in the following. I'll use, for convenience, the notation E(A, Z), where E is the symbol of the element, A is the atomic number
(neutrons + protons) and Z is the number of protons.
This reaction is typical of a fusion reaction, in the sun or in an H-bomb
H(2, 1) + H(3, 1) -> He(4, 2) + n(1, 0)
You can see that charge and nuclear numbers are conserved, but what about mass? Let's take a closer look. (I got the following numbers from
wikipedia, in atomic units)
Deuterium weighs 2.01355321270 u, Tritrium 3.0160492 u
Helium weighs 4.002602 u
neutrons weigh 1.008664904 u
The LHS weighs 5.0296024 u, the RHS 5.0112669, for a difference of a staggering 0.0183355 u. Let's convert this to kg - 0.0183355 * 1.667 x 10^-27 =
3.057 x 10^-29 kg.
E = mc^2, so let's do that... 3.057 x 10^-29 * (3 x 10^8)^2 = 2.751 x 10^-12 J, or about 4 MeV. Not bad.
So where does this energy come from? That's a long and complicated question, but basically in order to stick together and form atoms, protons and
neutrons gain a little bit of mass from the attractive force between them. When they're split apart or otherwise rearranged, they give off that mass
as energy.
So how efficient is an H-bomb (or the sun)?
Well, if you converted one atom of deuterium and one atom of tritrium into 100% energy (with antimatter or something...), you'd get 7.546 x 10^-10 J.
That's an efficency, from the theoretical max 100%, of 0.3645%.
Hope that answers the question!