original_string: private static function get_insert_batch_size(): int {
          global $DB;
  
          $dbconfig = $DB->export_dbconfig();
  
          // 500 is pgsql default so using 1000 is fine, no other db driver uses a hardcoded value.
          if (empty($dbconfig) || empty($dbconfig->dboptions) || empty($dbconfig->dboptions['bulkinsertsize'])) {
              return 1000;
          }
  
          $bulkinsert = $dbconfig->dboptions['bulkinsertsize'];
          if ($bulkinsert < 1000) {
              return $bulkinsert;
          }
  
          while ($bulkinsert > 1000) {
              $bulkinsert = round($bulkinsert / 2, 0);
          }
  
          return (int)$bulkinsert;
      }
code: private static function get_insert_batch_size(): int {
          global $DB;
  
          $dbconfig = $DB->export_dbconfig();
  
          // 500 is pgsql default so using 1000 is fine, no other db driver uses a hardcoded value.
          if (empty($dbconfig) || empty($dbconfig->dboptions) || empty($dbconfig->dboptions['bulkinsertsize'])) {
              return 1000;
          }
  
          $bulkinsert = $dbconfig->dboptions['bulkinsertsize'];
          if ($bulkinsert < 1000) {
              return $bulkinsert;
          }
  
          while ($bulkinsert > 1000) {
              $bulkinsert = round($bulkinsert / 2, 0);
          }
  
          return (int)$bulkinsert;
      }
code_tokens: private static function get_insert_batch_size ( ) : int { global $ DB ; $ dbconfig = $ DB -> export_dbconfig ( ) ; // 500 is pgsql default so using 1000 is fine, no other db driver uses a hardcoded value. if ( empty ( $ dbconfig ) || empty ( $ dbconfig -> dboptions ) || empty ( $ dbconfig -> dboptions [ 'bulkinsertsize' ] ) ) { return 1000 ; } $ bulkinsert = $ dbconfig -> dboptions [ 'bulkinsertsize' ] ; if ( $ bulkinsert < 1000 ) { return $ bulkinsert ; } while ( $ bulkinsert > 1000 ) { $ bulkinsert = round ( $ bulkinsert / 2 , 0 ) ; } return ( int ) $ bulkinsert ; }
docstring: Returns the batch size used for insert_records.
  
  This method tries to find the best batch size without getting
  into dml internals. Maximum 1000 records to save memory.
  
  @return int
docstring_tokens: Returns the batch size used for insert_records .