# vec-threshold, Qvec-threshold

Sets a threshold for the vectorization of loops.

## Syntax

Linux: | -vec-threshold[n]

macOS: | -vec-threshold[n]

Windows: | /Qvec-threshold[[:]n]

## Arguments

n | Is an integer whose value is the threshold for the vectorization of loops. Possible values are 0 through 100. If n is 0, loops get vectorized always, regardless of computation work volume. If n is 100, loops get vectorized when performance gains are predicted based on the compiler analysis data. Loops get vectorized only if profitable vector-level parallel execution is almost certain. The intermediate 1 to 99 values represent the percentage probability for profitable speed-up. For example, n=50 directs the compiler to vectorize only if there is a 50% probability of the code speeding up if executed in vector form.

## Default

-vec-threshold100 or /Qvec-threshold100 | Loops get vectorized only if profitable vector-level parallel execution is almost certain. This is also the default if you do not specify n.

## Description

This option sets a threshold for the vectorization of loops based on the probability of profitable execution of the vectorized loop in parallel.

This option is useful for loops whose computation work volume cannot be determined at compile-time. The threshold is usually relevant when the loop trip count is unknown at compile-time.

The compiler applies a heuristic that tries to balance the overhead of creating multiple threads versus the amount of work available to be shared amongst the threads.

## IDE Equivalent

Visual Studio: Optimization > Threshold For Vectorization

Eclipse: Optimization > Enable Maximum Vector-level Parallelism

Xcode: Optimization > Enable Maximum Vector-level Parallelism

## Alternate Options

None

Parent topic: Advanced Optimization Options