Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jonas Eriksson 930 posts 1825 karma points
    Oct 29, 2010 @ 04:18
    Jonas Eriksson
    0

    Python macro render slow for macro #2

    I have a dlr-macro running in #Umbraco. A single one runs fine. But when I add more than one in the template each one takes ~0.5 seconds.

    I found out it's my workaround to add the path to /Python that slows down.

    import sys
    import clr
    clr.AddReference('System.Web')
    from System.Web.HttpContext import Current;
    sys.path.append(Current.Server.MapPath('~/python'))

    Sadly the workaround is necessary in most scripts to be able to call other scripts due to this issue http://umbraco.codeplex.com/workitem/28473

    Would be awesome if some core dev had time to have a look at this.

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Oct 29, 2010 @ 04:24
    Aaron Powell
    0

    I didn't notice any problems on the site I recently was building with had at least 3 python macros at any given point

  • Jonas Eriksson 930 posts 1825 karma points
    Oct 29, 2010 @ 04:28
    Jonas Eriksson
    0

    I tried to edit and delete this topic, and got a confirmation it was deleted, but still there... Hm... Anyways, I will have another go with the Umbraco source myself, to try to find out what can be done, although I'm in deep water doing so. Last time I even failed to get it running.

     

  • Jonas Eriksson 930 posts 1825 karma points
    Oct 29, 2010 @ 04:56
    Jonas Eriksson
    0

    Hi Slace,

    I did this to test:

    Created a python-macro with the code from my post above.

    A simple template with the macro repeated :

     

    <%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>

    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
    <umbraco:Macro Alias="Smallmacro" runat="server">umbraco:Macro>
      <umbraco:Macro Alias="Smallmacro" runat="server">umbraco:Macro>
      <umbraco:Macro Alias="Smallmacro" runat="server">umbraco:Macro>
    asp:Content>

    Here's what my trace looks like, second and third macro takes 0.3 secs to load (not render as I thought), could it be a cache thing?:

    umbracoMacro    Macro loaded from cache (ID: 11, Smallmacro)    0,00209104788457751    0,000078
    renderMacro    Rendering started (macro: Smallmacro, type: 6, cacheRate: 0)    0,00214915582846423    0,000058
    umbracoMacro    DLR Script script added (smallmacro.py)    0,00221508599556648    0,000066
    umbracoMacro    Macro loaded from cache (ID: 11, Smallmacro)    0,315366059094103    0,313151
    renderMacro    Rendering started (macro: Smallmacro, type: 6, cacheRate: 0)    0,315507976572441    0,000142
    umbracoMacro    DLR Script script added (smallmacro.py)    0,315575024200003    0,000067
    umbracoMacro    Macro loaded from cache (ID: 11, Smallmacro)    0,604867099030743    0,289292
    renderMacro    Rendering started (macro: Smallmacro, type: 6, cacheRate: 0)    0,60497605142553    0,000109
    umbracoMacro    DLR Script script added (smallmacro.py)    0,605034997464762    0,000059

     

  • Jonas Eriksson 930 posts 1825 karma points
    Oct 29, 2010 @ 05:28
    Jonas Eriksson
    0

    I tested some more, on all tests I see the second python-macro takes more time to load. Simpler macros not considerably much. I tested with a macro containing only print "x" . There the first instance takes 0,000242 s to load, but the second takes 0,013654 s

    But with the import of a class or two the time can be up to 0.5 seconds for the 2nd macro+.

  • Jonas Eriksson 930 posts 1825 karma points
    Oct 29, 2010 @ 15:52
    Jonas Eriksson
    0

    Same goes for a simple Ruby macro aswell. Made a Test.rb with only Puts "yo" and added it five times on one template. 1 time it loads fast, but 2:nd time + takes ~0.07 seconds. For a more complex macro it slows down more, but still only on 2'nd macro, first ones does not have this strange extra load time.

Please Sign in or register to post replies

Write your reply to:

Draft