[WiP] Log performance improvements (1 Viewer)

Neos

Portal Member
February 14, 2008
18
15
Netherlands Netherlands
This patch's main intent is to improve the performance of the one method that is, obviously, called the most throughout any application. It changes the ILog interface removing the params object[] args from each of the logging methods: Info, Error, Warn and Debug. Internally when not specifying any arguments the compiler generates an empty object array for you. The framework's developers optimized calls to such methods by overloading them with a default of 3 extra arguments (see Console.WriteLine or String.Format). For an log-line that requires less than 3 arguments this is about 3-4 IL instructions less. Adding extra overloads is simple and truly worth the performance gain, especially in projects that make extensive use such of the params keyword.

When the callee does require formatting of his log a new set of overloads has been added to the static Log classes in MediaPortal.ServiceImplementations and MediaPortal.GUI.Library. These overloads call string.Format passing the formatted string to the actual instance of the ILog interface. For each log method 3 overloads exists fully exploiting the the string.Format optimizations in the Framework.

In addition I have removed several direct calls to the GlobalServiceProvider class in favor of the static log classes. The USBUIRT Plugin kept a local reference to the the central ILog interface, this has also been replaced with a call to the static log class.

Edit: In all my I forgot one crucial thing, still in essence this patch should improve performance be it not that the formatting isn't done when for messages not written to the log. My patch does (sadly enough), at this point in time, always format text even if it is not logged. Rather careless of me to to this before submitting my patch. Tomorrow I will provided a better version that DOES do what it should do.
 

Attachments

SilentException

Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Croatia Croatia
    Country flag
    Yup, thanks so much Neos. But the patches will have to wait until 1.2 is released. We're in the future freeze.

    Bug fixes are still allowed to go in, so if you try to separate bug fixes from optimizations/features, I'll try to take a look ASAP.
     

    disaster123

    MP Donator
  • Premium Supporter
  • May 14, 2008
    3,546
    432
    Germany Germany
    Country flag
    AW: Log performance improvements

    SilentException
    wouldn't it then make sense to make already a branch for 1.2 so that patches can still go into trunk?
     

    SilentException

    Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Croatia Croatia
    Country flag
    Not really, if anything it would slow our already (too) long release cycle even more. At this point we need to concentrate on finding and fixing any bugs and not on new features. Sadly, closing trunk (feature freeze) is only option to somehow force developers to do that.
     

    Neos

    Portal Member
    February 14, 2008
    18
    15
    Netherlands Netherlands
    Yup, thanks so much Neos. But the patches will have to wait until 1.2 is released. We're in the future freeze.

    Bug fixes are still allowed to go in, so if you try to separate bug fixes from optimizations/features, I'll try to take a look ASAP.
    No problems, I must say this is indeed more of a performance feature then bug fix. I'll seperate it into a bug fix and repost the improved performance feature for the log later.

    Edit: Added a patch that fixes several classes that accessed the log through the GlobalServiceProvider class instead of the static Log class.
     

    Attachments

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    OP Similar threads Forum Replies Date
    horned_reaper Errors in FH log ... Fanart Handler 1
    catavolt [WiP] When changing theme in my skins, I always get this error message in logs MediaPortal 1 9
    horned_reaper MediaPortal configuration error log message General Support 1
    horned_reaper MiniDisplayStatus error log messages General Support 7
    horned_reaper [solved] GUITextureManager Load2 log error messages Fanart Handler 1
    horned_reaper MediaPortal.LastFM.LastFMException error log message General Support 1
    doskabouter Exceptions found due to improved logging General Support 11
    ajs Can't log in to MyGet Online Facilities 4
    HTPCSourcer Media Accessor is flooding logs with files from attached monitor MediaPortal 2 9
    F Audio render and font error in my logs General Support 2
    HTPCSourcer [fixed] [MP2-815] User not logged in when resuming from standby MediaPortal 2 17
    T No TV after updating Windows 10 to latest Version 1903 / OS build 18362.175 (logs attached) General Support 2
    T [solved] "Unable To Play" (Videos) rears it's head again. Logs not possible... WatchDog error attached!! :( General Support 1
    T Get this error message on attempted re-install...LOGS inc. General Support 4
    HTPCSourcer [solved] Can't log in to Wiki Online Facilities 3
    N [Question] How come when I build WIP_2.2.1 the logged version number is 2.1.1711.10774? MediaPortal 2 1
    J Trying out MP 1 again, have some questions and a few log files Newcomers Forum 5
    Terra [Rejected] Log Media Anonymization/Masking Feature Requests 4
    T Mp 1.20 won't play .265 hdr capable file......settings problem? logs inc. Watch / Listen Media 0
    CyberSimian Inappropriate error messages in the log file MediaPortal 1 0
    S MP restarts after 10-30 sec - how to read error logs General Support 1
    T Moving Pictures error after update to 1.19 Final...logs included! Watch / Listen Media 6
    hwahrmann [Question] Performance of TeamMediaportal @ Myget Developer Discussions 1
    F GUI incredibly slow Performance General 22
    C How well can MediaPortal handle 10,000+ recordings? MediaPortal 1 Talk 3
    Similar threads

























    Top Bottom