You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ag...@apache.org on 2022/08/30 14:44:12 UTC

[arrow-datafusion] branch master updated: fix: speed up `ConfigOptions` creation (#3296)

This is an automated email from the ASF dual-hosted git repository.

agrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new 7dedcb196 fix: speed up `ConfigOptions` creation (#3296)
7dedcb196 is described below

commit 7dedcb1963a3ff0c3ca276c43bff62373b608a4e
Author: Marco Neumann <ma...@crepererum.net>
AuthorDate: Tue Aug 30 14:44:04 2022 +0000

    fix: speed up `ConfigOptions` creation (#3296)
    
    Fixes #3295.
---
 datafusion/core/src/config.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/datafusion/core/src/config.rs b/datafusion/core/src/config.rs
index 054c66bf5..3c828079e 100644
--- a/datafusion/core/src/config.rs
+++ b/datafusion/core/src/config.rs
@@ -207,8 +207,8 @@ impl Default for ConfigOptions {
 impl ConfigOptions {
     /// Create new ConfigOptions struct
     pub fn new() -> Self {
-        let mut options = HashMap::new();
         let built_in = BuiltInConfigs::new();
+        let mut options = HashMap::with_capacity(built_in.config_definitions.len());
         for config_def in &built_in.config_definitions {
             options.insert(config_def.key.clone(), config_def.default_value.clone());
         }
@@ -216,10 +216,10 @@ impl ConfigOptions {
     }
 
     /// Create new ConfigOptions struct, taking values from environment variables where possible.
-    /// For example, setting DATAFUSION_EXECUTION_BATCH_SIZE to control `datafusion.execution.batch_size`.
+    /// For example, setting `DATAFUSION_EXECUTION_BATCH_SIZE` to control `datafusion.execution.batch_size`.
     pub fn from_env() -> Self {
-        let mut options = HashMap::new();
         let built_in = BuiltInConfigs::new();
+        let mut options = HashMap::with_capacity(built_in.config_definitions.len());
         for config_def in &built_in.config_definitions {
             let config_value = {
                 let mut env_key = config_def.key.replace('.', "_");