MAST

An example of MAST implementation in 100 lines of code (https://www.irccloud.com/pastebin/0ZNKfNvC/ )
The idea is to decompose all the possible execution paths of a script, and make merkle tree from that.
The wit commitment would need only the executed path and the partial merkle tree to it.

Saving may be negative, but none executed sigops will not be counted for the block, and saving can be done by using Hash160 instead of Hash256 for the merkle tree.

Script decomposition

MerkleRoot29e9ac305b880e125d3fac68e420a42c248f2a9703f9566c8d07bd57855581c0
ScriptOP_HASH160 OP_DUP 8a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc81 OP_EQUAL OP_IF 0cbd OP_CLTV OP_2DROP 8a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc81 OP_ELSE 8a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc81 OP_EQUAL OP_NOTIF 0cbd OP_CLTV OP_ENDIF 8a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc81 OP_ENDIF OP_CHECKSIG
Size151

Script 0

StringOP_HASH160 OP_DUP 8a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc81 OP_EQUAL OP_VERIFY 0cbd OP_CLTV OP_2DROP 8a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc81 OP_CHECKSIG
Bytes
a976208a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc818769020cbdb16d208a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc81ac
Hashbe9a394f4be116aa992c08cb3239f3c98567c998e7595f46ca3ad662eed89c8b
PartialMerkleTree03000000038b9cd8ee62d63aca465f59e798c96785c9f33932cb082c99aa16e14b4f399abebcf757271d1487d966a124eb1e633b7157be10a4e4db8f819adbbde6d0bacb9ec81d8ad9605200985487265a80d85b97644a30cac08e631338cf7938954150f70107

Size of commitment (Merkle Tree + Script)

Size with HASH256179
Saving with HASH256-18 %
Size with HASH160140
Saving with HASH1607 %

Script 1

StringOP_HASH160 OP_DUP 8a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc81 OP_EQUAL OP_NOT OP_VERIFY 8a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc81 OP_EQUAL OP_VERIFY 8a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc81 OP_CHECKSIG
Bytes
a976208a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc81879169208a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc818769208a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc81ac
Hash9ecbbad0e6bddb9a818fdbe4a410be57713b631eeb24a166d987141d2757f7bc
PartialMerkleTree03000000038b9cd8ee62d63aca465f59e798c96785c9f33932cb082c99aa16e14b4f399abebcf757271d1487d966a124eb1e633b7157be10a4e4db8f819adbbde6d0bacb9ec81d8ad9605200985487265a80d85b97644a30cac08e631338cf7938954150f7010b

Size of commitment (Merkle Tree + Script)

Size with HASH256210
Saving with HASH256-39 %
Size with HASH160171
Saving with HASH160-13 %

Script 2

StringOP_HASH160 OP_DUP 8a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc81 OP_EQUAL OP_NOT OP_VERIFY 8a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc81 OP_EQUAL OP_NOT OP_VERIFY 0cbd OP_CLTV 8a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc81 OP_CHECKSIG
Bytes
a976208a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc81879169208a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc81879169020cbdb1208a32aa42900a5f3cdc1c9bf93f12597ca56f9335210d019e12aed94528cacc81ac
Hash2447e4ec9a82d8796d5a496a65fbf3d3f56087f71338f641dc3dbb4db0b0863a
PartialMerkleTree0300000002ed36f10c923747224fe9b0a82cd33e572058c008ba0cb3b856c06ba1652572713a86b0b04dbb3ddc41f63813f78760f5d3f3fb656a495a6d79d8829aece44724010d

Size of commitment (Merkle Tree + Script)

Size with HASH256183
Saving with HASH256-21 %
Size with HASH160156
Saving with HASH160-3 %