ARRAY ELEMENT KEY BUILDING
When writing marshaling layers between higher level languages and Libbson, you will eventually need to build keys for array elements. Each element in a BSON array has a monotonic string key like 0 , 1 , etc. Using snprintf(3) and others tend to be rather slow on most libc implementations. Therefore, Libbson provides bson_uint32_to_string(3) to improve this. Using this function allows an internal fast path to be used for numbers less than 1000 which is the vast majority of arrays. If the key is larger than that, a fallback of snprintf(3) will be used.
For more information, see bson_uint32_to_string(3) \&.