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 1 runs. Higher numbers are better.

Identifier Indicator Name TI TA-Lib Result
absVector Absolute Value2,556--
acosVector Arccosine88tie
adAccumulation/Distribution Line225222tie
addVector Addition2,2611,547TI is 46% faster
adoscAccumulation/Distribution Oscillator207223tie
adxAverage Directional Movement Index6432TI is 100% faster
adxrAverage Directional Movement Rating5031TI is 61% faster
aoAwesome Oscillator506--
apoAbsolute Price Oscillator337157TI is 114% faster
aroonoscAroon Oscillator8787tie
asinVector Arcsine88tie
atanVector Arctangent1616tie
atrAverage True Range20274TI is 172% faster
avgpriceAverage Price1,306744TI is 75% faster
bbandsBollinger Bands21659TI is 266% faster
bopBalance of Power222221tie
cciCommodity Channel Index188TI is 125% faster
ceilVector Ceiling7476tie
cmoChande Momentum Oscillator90--
cosVector Cosine2120tie
coshVector Hyperbolic Cosine1818tie
cviChaikins Volatility224--
decayLinear Decay374--
demaDouble Exponential Moving Average420153TI is 174% faster
diDirectional Indicator8674TI is 16% faster
divVector Division223221tie
dmDirectional Movement186140TI is 32% faster
dpoDetrended Price Oscillator618--
dxDirectional Movement Index6837TI is 83% faster
edecayExponential Decay352--
emaExponential Moving Average334339tie
emvEase of Movement74--
expVector Exponential2222tie
fisherFisher Transform15--
floorVector Floor7574tie
foscForecast Oscillator227--
hmaHull Moving Average65--
kamaKaufman Adaptive Moving Average225170TI is 32% faster
kvoKlinger Volume Oscillator119--
linregLinear Regression33714TI is 2,307% faster
linreginterceptLinear Regression Intercept36015TI is 2,300% faster
linregslopeLinear Regression Slope50616TI is 3,062% faster
lnVector Natural Log2828tie
log10Vector Base-10 Log2828tie
macdMoving Average Convergence/Divergence31696TI is 229% faster
marketfiMarket Facilitation Index222--
massMass Index202--
maxMaximum In Period221212tie
mdMean Deviation Over Period19--
medpriceMedian Price2,0271,589TI is 27% faster
mfiMoney Flow Index9197tie
minMinimum In Period190173TI is 9% faster
momMomentum2,3521,278TI is 84% faster
mulVector Multiplication2,2611,507TI is 50% faster
natrNormalized Average True Range17363TI is 174% faster
nviNegative Volume Index426--
obvOn Balance Volume367334TI is 9% faster
ppoPercentage Price Oscillator22596TI is 134% faster
psarParabolic SAR131139tie
pviPositive Volume Index429--
rocRate of Change227225tie
rocrRate of Change Ratio227229tie
roundVector Round75--
rsiRelative Strength Index21277TI is 175% faster
sinVector Sine2021tie
sinhVector Hyperbolic Sine1818tie
smaSimple Moving Average653230TI is 183% faster
sqrtVector Square Root235235tie
stddevStandard Deviation Over Period23178TI is 196% faster
stderrStandard Error Over Period221--
stochStochastic Oscillator5050tie
stochrsiStochastic RSI5136TI is 41% faster
subVector Subtraction2,2611,589TI is 42% faster
sumSum Over Period683582TI is 17% faster
tanVector Tangent1818tie
tanhVector Hyperbolic Tangent3030tie
temaTriple Exponential Moving Average326106TI is 207% faster
todegVector Degree Conversion2,672--
toradVector Radian Conversion2,556--
trTrue Range212185TI is 14% faster
trimaTriangular Moving Average452448tie
trixTrix22777TI is 194% faster
truncVector Truncate494--
tsfTime Series Forecast36015TI is 2,300% faster
typpriceTypical Price1,547226TI is 584% faster
ultoscUltimate Oscillator4624TI is 91% faster
varVariance Over Period565117TI is 382% faster
vhfVertical Horizontal Filter83--
vidyaVariable Index Dynamic Average79--
volatilityAnnualized Historical Volatility77--
voscVolume Oscillator230--
vwmaVolume Weighted Moving Average227--
wadWilliams Accumulation/Distribution213--
wcpriceWeighted Close Price1,200933TI is 28% faster
wildersWilders Smoothing339--
willrWilliams %R7672tie
wmaWeighted Moving Average226227tie
zlemaZero-Lag Exponential Moving Average369--

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.

64,358 ms92,616 ms

That is, TI on average is 44% 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.