Does there exist a realistic performance benchmark between map/bigmap?

I am looking for a tipping point where it would make more sense to use a big map for gas cost optimization

1 Answer 1


Let's find out. We start by running a sandbox node. We'll originate two contracts, one for maps, the other for bigmap.

parameter (pair address nat);
storage (big_map address nat);
    DIP { SOME };
    NIL operation;

(this is the big_map version, the map version is the same with the type "bigmap" changed to "map").

First difference, the map version takes 0.361 tez in origination burn compared to 0.391 tez for the bigmap version.

We'll use a small python program to generate dummy addresses, genadd.py

import base58, random
print(base58.b58encode_check(b'\x06\xa1\x9f' + bytes([random.getrandbits(8) 
   for i in range(0,20)])).decode('ascii'))

We call the contract as:

tezos-client transfer 0 from bootstrap1 to bench_map --arg '(Pair "'./genadd.py'" 0)' -D --burn-cap 0.031

The burn cap is 0.031 and 13363 of gas is consumed.

In contrasts, for the bigmap, the burn cap needed is 0.067 and the gas consummed is 13395. Avantage: map.

Second insertion: burn caps are unchanged, 13395 gas for the bigmap, but, now, 14285 gas for the map.

So there you have it. After the first element is inserted, it becomes gas-sparing to use a bigmap as opposed to a map.

Let's look at a third element out of curiosity. Burn caps are unchanged, gas for the map is 15231 and gas for the bigmap is unchanged at 13395.

From this is becomes clear that for each element in the map, we add about 900 to the gas cost. This adds up quickly.

However, that benchmark does not show everything! If you want to access only one key, clearly the bigmap is better, but if you wanted to access all of the keys, or many keys, the map might be better.

  • Awesome Description, Thanks a lot! is it feasible to have multiple big_maps in a contract or big_map inside a big_map ? Commented Apr 6, 2020 at 10:53
  • 2
    1.Multiple big_maps: YES. 2. big_map of big_map: NO.
    – Daly
    Commented May 12, 2020 at 23:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.