today I started for the first time using quantconnect and the Lean engine. I'm curious what's the reason for such inredibly slow backtest performance? I use BasicTemplateAlgorithm.cs and I simply changed it to do raw SPY with second resolution for four days (from 2013/10/07 to 2013/10/11).

Originally the template had:

            if (!Portfolio.Invested)
                SetHoldings(_spy, 1);
                Debug("Purchased Stock");

with this it would proabbly take hours to run the backtest, somehow I was getting "Purchased stock" message over and over again. So, I commented it out and made effectively my OnData do nothing and ... it would take huge amount of time to do nothing at all. I do C++, and I'd expect that basic SPY with second resolution that doesn't do too much complex computations would take a few secons to run over 10 years (which should be roughly 60M seconds).


In a couple of hours I'd be able to write from scratch a c++ program that reads thouse SPY zips and calls raw OnData and I'm pretty sure it will take perhaps thousand times less that it takes now. I'm sure it's not c# performance, but something else kills it. Any ideas?