setThreadCount: Function to set the thread count for a specific 'data.table'...

View source: R/setThreadCount.r

setThreadCountR Documentation

Function to set the thread count for a specific data.table function

Description

Function to set the thread count for a specific data.table function

Usage

setThreadCount(
  benchmarkData,
  functionName,
  efficiencyFactor = 0.5,
  verbose = FALSE
)

Arguments

benchmarkData

A data.table of class data_table_threads_benchmark containing benchmarked timings with corresponding thread counts.

functionName

The name of the data.table function for which to set the thread count.

efficiencyFactor

A numeric value between 0 and 1 indicating the desired efficiency level for thread count selection. 0 represents use of the optimal thread count (lowest median runtime) and 0.5 represents the recommended thread count.

verbose

Option (logical) to enable or disable detailed message printing.

Details

Sets the thread count to either the optimal (fastest median runtime) or recommended value (default) based on the chosen type argument for the specified data.table function based on the results obtained from findOptimalThreadCount().

Value

NULL.

Examples

# Finding the best performing thread count for each benchmarked data.table function
# with a data size of 1000 rows and 10 columns:
benchmarkData <- data.table.threads::findOptimalThreadCount(1e3, 10)
# Setting the optimal thread count for the 'forder' function:
setThreadCount(benchmarkData, "forder", efficiencyFactor = 1)
# Can verify by checking benchmarkData and getDTthreads():
data.table::getDTthreads()

data.table.threads documentation built on April 3, 2025, 10:08 p.m.