findOptimalThreadCount: Function that finds the optimal (fastest) thread count for...

View source: R/findOptimalThreadCount.R

findOptimalThreadCountR Documentation

Function that finds the optimal (fastest) thread count for different data.table functions

Description

This function finds the optimal thread count for running data.table functions with maximum efficiency.

Usage

findOptimalThreadCount(rowCount, colCount, times = 10, verbose = FALSE)

Arguments

rowCount

The number of rows in the data.table.

colCount

The number of columns in the data.table.

times

The number of times the benchmarks are to be run.

verbose

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

Details

Iteratively runs benchmarks with increasing thread counts and determines the optimal number of threads for each data.table function.

Value

A data.table of class data_table_threads_benchmark containing the optimal thread count for each data.table function.

Examples

# Finding the best performing thread count for each benchmarked data.table function
# with a data size of 1000 rows and 10 columns:
(optimalThreads <- data.table.threads::findOptimalThreadCount(1e3, 10))

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