Information presented in this post might be useful for the new users, or those who would like to take full advantage of AmiBroker's performance. For example it shows, why it's a better idea to use SumSince()
whenever possible instead of Sum()
or Cum()
etc.
It is because of the fact, that most programs usually become bigger and slower with each new release. On the contrary, AmiBroker is becoming faster and faster.
Here are some examples of the changes implemented in previous versions, which make code execution faster. These are excerpts from Read Me files attached to each AB release: www.amibroker.com/devlog/ :
v.6.22
64-bit: Migrated all code to new compiler VC++2017 which seems to produce better code for x64 resulting in 30…50% speed improvements for many AFL functions. The only negative seems to be much bigger runtime libs
64-bit: AFL: Sum() function 2x faster
64-bit: AFL: Max() and Min() functions 8x faster
64-bit: AFL: Ref() function 2x faster
64-bit: AFL: MACD(), ROC(), StDev(), LinearReg() and many other functions faster by 30-50%
v.6.21
AFL: Decreased memory fragmentation when user changes type of variable from array to scalar and back thousands of times
AFL: RequestMouseMoveRefresh( ) – request formula execution / refresh when mouse is moved INSIDE given chart pane (it only triggers for ONE window under the cursor)
v. 6.13
AFL: MA function made upto 2 times faster , StDev function made 20% faster , Correlation made 40% faster
v. 6.11
AFL: MxFromString was slow on very large matrices (>100000 cells) due to poor performance of strtod function from Microsoft C runtime. Now MxFromString does not use it and is even 1000 times faster on 100K+ cell matrices (5ms vs 5second)
ASCII importer can now be even 20 times faster when importing NEW (non existing) data that were oddly sorted (like for example in reverse order - descending dates instead of ascending).
ASCII importer is now twice as fast when updating already existing quotes thanks to using in-house code instead of msvcrt functions.
When there were thousands of files in "Formulas" folder opening editor for the first time could take some time. Now this time is significantly reduced.
v. 6.07
Compression of persistent static variables (and arrays) implemented - can save as much as 90% of disk space and memory
v. 6.06
AFL: new function SumSince – a fast sum of array elements since condition was true, works like Cum( array ) – ValueWhen( condition, Cum( array ) ) or Sum( array, BarsSince( condition ), but much faster.
According to my measurements new SumSince is indeed many times faster than Sum().
AFL: Variable period Sum() performance improved significantly when period changes +/-1 on bar by bar basis
AFL: new function GfxFillSolidRect ( x1, y1, x2, y2, color ) – it is fastest method to fill solid rectangle with single color (faster than GfxRectangle)
v. 6.02
Faster composites by means of new function StaticVarAdd. Single threaded StaticVarAdd may be twice as fast as ATC. With 8 threads running StaticVarAdd may be 4x as fast. StaticVarAdd( “name”, value, keepAll = True, persistent = False ) – an atomic addition (interlocked read-add-write) operation for static variables.
v. 6.0
Full Matrix support
v. 5.91
Analysis: CSV Export speeded up 100+ times . Now exporting large files takes seconds instead of hours. Export speeds on ordinary hard disks > 80MB/sec
v. 5.90
AFL Engine: custom memory allocator does not use Microsoft runtime lib for reference tracking anymore. Result - complex formulas with lots of loops and OLE (especially low-level custom backtests) run upto 3 times faster in 32 bit and 4 times faster in 64-bit
Execution speed improved by factor > 2x for AFL functions: MACD, Signal, CCI, Sum (variable period)
v. 5.88
New Analysis: QuickAFL finally implemented. To turn it on go to Settings and check “Use QuickAFL” box. Gives very significant speed-ups (>2x) when range is smaller than “All quotes”
v. 5.82
AFL: CCI function speeded up by 50%
v. 5.80
AFL: Co-ordinates can now be given in both pixels and bar-price mode GfxSetCoordsMode - speed improvements (upto 3x)
etc ...
For the reasons above, whether someone wants to achieve full performance on the latest, sophisticated workstation or is very attached to his/her "Millennium Edition" computer from the year 2000
should be using the most recent, not the oldest version of AmiBroker...