The sizeof() efun may be used to determine how many key/value pairs are in the mapping. For example:
Example 5-14. Using sizeof() on a mapping
mapping m = ([ "i": 1, "iv": 4 ]); write(sprintf("mapping m contains %d key/value pairs.\n", sizeof(m)));