Save transaction space with economic Scripts
Yes, that would save space. However, there are two ways in which your scripts are different.


It checks if there is a value that hashes to the hash of x at the beginning,
It performs the operation in step 1 whether we're executing branch 1 or 2.


Your first script can be rewritten like so to fix that:

OP_NOTIF
  &lt;key A&gt; OP_CHECKSIGVERIFY
  OP_0
OP_ELSE
  OP_1
OP_ENDIF
OP_SWAP
&lt;key B&gt; OP_CHECKSIG
OP_IF
  OP_SHA256 &lt;hash of secret x&gt; OP_EQUAL
OP_ENDIF


Space savings

Each public key is 34 bytes (33 bytes for compressed key plus 1 for data push). Blocks are about 617k at the moment, and the total fees for a block are about 0.223 BTC. Each public key therefore costs:

34 / 617000 * 0.223 * 1e8 = 1228 satoshis


A small amount, but it would add up over time.