Tulip Indicators

Speed Benchmark

Fork me on GitHub

Tulip Indicators is fast.

Below are benchmark numbers comparing TI indicator function performance with TA-Lib version 0.4. The values are millions of bars processed per second. Each value is taken as the best of 5 runs. Higher numbers are better.

Identifier Indicator Name TI TA-Lib Result
absVector Absolute Value2,800--
acosVector Arccosine99tie
adAccumulation/Distribution Line251251tie
addVector Addition3,9201,896TI is 106% faster
adoscAccumulation/Distribution Oscillator221250TA-Lib is 13% faster
adxAverage Directional Movement Index6934TI is 102% faster
adxrAverage Directional Movement Rating5334TI is 55% faster
aoAwesome Oscillator539--
apoAbsolute Price Oscillator376170TI is 121% faster
aroonAroon8585tie
aroonoscAroon Oscillator9494tie
asinVector Arcsine99tie
atanVector Arctangent1817tie
atrAverage True Range20978TI is 167% faster
avgpriceAverage Price1,896933TI is 103% faster
bbandsBollinger Bands23564TI is 267% faster
bopBalance of Power251250tie
cciCommodity Channel Index199TI is 111% faster
ceilVector Ceiling7878tie
cmoChande Momentum Oscillator96--
cosVector Cosine2222tie
coshVector Hyperbolic Cosine1919tie
crossanyCrossany753--
crossoverCrossover1,251--
cviChaikins Volatility235--
decayLinear Decay420--
demaDouble Exponential Moving Average420170TI is 147% faster
diDirectional Indicator8980TI is 11% faster
divVector Division251250tie
dmDirectional Movement209150TI is 39% faster
dpoDetrended Price Oscillator753--
dxDirectional Movement Index7340TI is 82% faster
edecayExponential Decay374--
emaExponential Moving Average376376tie
emvEase of Movement78--
expVector Exponential2423tie
fisherFisher Transform16--
floorVector Floor8078tie
foscForecast Oscillator251--
hmaHull Moving Average71--
kamaKaufman Adaptive Moving Average251188TI is 33% faster
kvoKlinger Volume Oscillator125--
lagLag3,920--
linregLinear Regression37615TI is 2,406% faster
linreginterceptLinear Regression Intercept42016TI is 2,525% faster
linregslopeLinear Regression Slope53917TI is 3,070% faster
lnVector Natural Log3030tie
log10Vector Base-10 Log2929tie
macdMoving Average Convergence/Divergence32698TI is 232% faster
marketfiMarket Facilitation Index227--
massMass Index211--
maxMaximum In Period223217tie
mdMean Deviation Over Period20--
medpriceMedian Price2,0271,589TI is 27% faster
mfiMoney Flow Index10094tie
minMinimum In Period196176TI is 11% faster
momMomentum2,4501,400TI is 75% faster
mulVector Multiplication2,4501,589TI is 54% faster
natrNormalized Average True Range18662TI is 200% faster
nviNegative Volume Index432--
obvOn Balance Volume328328tie
ppoPercentage Price Oscillator23197TI is 138% faster
psarParabolic SAR132144TA-Lib is 9% faster
pviPositive Volume Index445--
qstickQstick700--
rocRate of Change235236tie
rocrRate of Change Ratio234236tie
roundVector Round73--
rsiRelative Strength Index23581TI is 190% faster
sinVector Sine2222tie
sinhVector Hyperbolic Sine1919tie
smaSimple Moving Average753251TI is 200% faster
sqrtVector Square Root251269tie
stddevStandard Deviation Over Period25185TI is 195% faster
stderrStandard Error Over Period251--
stochStochastic Oscillator5553tie
subVector Subtraction3,9201,896TI is 106% faster
sumSum Over Period753632TI is 19% faster
tanVector Tangent1919tie
tanhVector Hyperbolic Tangent3333tie
temaTriple Exponential Moving Average376110TI is 241% faster
todegVector Degree Conversion3,920--
toradVector Radian Conversion3,675--
trTrue Range235197TI is 19% faster
trimaTriangular Moving Average534539tie
trixTrix25183TI is 202% faster
truncVector Truncate539--
tsfTime Series Forecast37615TI is 2,406% faster
typpriceTypical Price1,896251TI is 655% faster
ultoscUltimate Oscillator5025TI is 100% faster
varVariance Over Period632125TI is 405% faster
vhfVertical Horizontal Filter91--
vidyaVariable Index Dynamic Average85--
volatilityAnnualized Historical Volatility81--
voscVolume Oscillator251--
vwmaVolume Weighted Moving Average251--
wadWilliams Accumulation/Distribution235--
wcpriceWeighted Close Price1,8961,251TI is 51% faster
wildersWilders Smoothing376--
willrWilliams %R8378tie
wmaWeighted Moving Average251251tie
zlemaZero-Lag Exponential Moving Average420--

All numbers are generated from the benchmark program included in the Tulip Indicators source distribution. The missing numbers in the TA-Lib column represents functions that only TI implements. Functions that only TA-Lib implements aren't tested.

It is worth pointing out that the benchmark program also compares the output from the two libraries. They must match for the benchmark to succeed (otherwise it wouldn't be a fair test). This is only a small part of the rigorous testing that TI has been subjected to.

Considering only the functions that both TI and TA-Lib implement, the total time to run the entire benchmark suite is presented below. Lower is better.

TI TA-Lib
58,737 ms85,062 ms

That is, TI on average is 45% faster than TA-Lib.

The primary goal of TI was to implement a clean easy-to-use interface with straight-forward and reliable code. Performance optimization takes a backseat to those goals. Where TI is much faster than TA-Lib, it is usually because TI uses a better algorithm. For example, TI does Linear Regression an order of magnitude faster than TA-Lib. This is because TI takes essentially one pass through the input data, but TA-Lib uses an inefficient algorithm that ends up looking at the input data multiples times. Another example: TI calculates Trix in one pass, TA-Lib uses four.