SmartQuant Discussion
http://www.smartquant.com/forums/

Logging Engine (log) slow
http://www.smartquant.com/forums/viewtopic.php?f=86&t=14721
Page 1 of 1

Author:  mikembb [ Fri Jul 14, 2017 4:41 pm ]
Post subject:  Logging Engine (log) slow

Dear team,

when I log with this code:
Code:
Log(Math.Round(position1.Value * 0.00001,2), "P1Value");


the events per second drop dramatically, to like 20k from maybe 500k.

If I change the code to this:
Code:
double p1Value = Math.Round(Position1.Value * 0.00001, 2);
                                Log(p1Value, "P1Value");


then, I get the 500k events per second.

Could you look into that what causes this delay?

Regards
Mike

Author:  skuvv [ Mon Oct 30, 2017 1:19 pm ]
Post subject:  Re: Logging Engine (log) slow

Performance of logs is highly correlated with frequency of using.
It is huge difference to log at each bar and log at each tick.
At the end there can be swapping on the disk, so you should check that you have enough memory.

Author:  mikembb [ Wed Nov 01, 2017 2:01 pm ]
Post subject:  Re: Logging Engine (log) slow

Thanks. I fully understand your reply.

Tough, when I do the same logging, as I tried to descirbe, and the only difference is how I call the function log, then there should not be so much difference, right?

Thanks
Mike

Author:  skuvv [ Thu Nov 02, 2017 4:43 pm ]
Post subject:  Re: Logging Engine (log) slow

I did a small test.
Using SMACrossover with AAPL and MSFT I added new group:
Code:
         Group("P1Value", "Pad", 2);

And method for logging:
Code:
      protected override void OnTrade(SmartQuant.Instrument instrument, SmartQuant.Trade trade)
      {
         Log(Math.Round(Position.Value * 0.00001,2), "P1Value");
         
//         double p1Value = Math.Round(Position.Value * 0.00001, 2);
//         Log(p1Value, "P1Value");
      }


Results:
no Log:
570000events/sec

Code:
Log(Math.Round(Position.Value * 0.00001,2), "P1Value");

490000events/sec

Code:
double p1Value = Math.Round(Position.Value * 0.00001, 2);
Log(p1Value, "P1Value");

490000events/sec

So there is no the visible difference as you described.
But logging at each trade will give results for 80000(-14%) less in performance(for current test).
Because total amount of additional logs is about 1 mil.

ps is position1 equals to Position1?

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/