mirror of
https://github.com/biojppm/rapidyaml.git
synced 2026-01-18 13:31:19 +01:00
Declare estimate_tree_capacity() at top of file
This commit is contained in:
@@ -213,6 +213,22 @@ typedef enum BlockChomp_ {
|
||||
} BlockChomp_e;
|
||||
|
||||
|
||||
/** Quickly inspect the source to estimate the number of nodes the
|
||||
* resulting tree is likely to have. If a tree is empty before
|
||||
* parsing, considerable time will be spent growing it, so calling
|
||||
* this to reserve the tree size prior to parsing is likely to
|
||||
* result in a time gain. We encourage using this method before
|
||||
* parsing, but as always measure its impact in performance to
|
||||
* obtain a good trade-off.
|
||||
*
|
||||
* @note since this method is meant for optimizing performance, it
|
||||
* is approximate. The result may be actually smaller than the
|
||||
* resulting number of nodes, notably if the YAML uses implicit
|
||||
* maps as flow seq members as in `[these: are, individual:
|
||||
* maps]`. */
|
||||
RYML_EXPORT id_type estimate_tree_capacity(csubstr src); // NOLINT(readability-redundant-declaration)
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -726,21 +742,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
/** Quickly inspect the source to estimate the number of nodes the
|
||||
* resulting tree is likely have. If a tree is empty before
|
||||
* parsing, considerable time will be spent growing it, so calling
|
||||
* this to reserve the tree size prior to parsing is likely to
|
||||
* result in a time gain. We encourage using this method before
|
||||
* parsing, but as always measure its impact in performance to
|
||||
* obtain a good trade-off.
|
||||
*
|
||||
* @note since this method is meant for optimizing performance, it
|
||||
* is approximate. The result may be actually smaller than the
|
||||
* resulting number of nodes, notably if the YAML uses implicit
|
||||
* maps as flow seq members as in `[these: are, individual:
|
||||
* maps]`. */
|
||||
RYML_EXPORT id_type estimate_tree_capacity(csubstr src); // NOLINT(readability-redundant-declaration)
|
||||
|
||||
/** @} */
|
||||
|
||||
} // namespace yml
|
||||
|
||||
Reference in New Issue
Block a user