Copied to clipboard

Flag this post as spam?

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


  • Jeffrey Schoemaker 408 posts 2138 karma points MVP 8x c-trib
    Oct 26, 2012 @ 14:17
    Jeffrey Schoemaker
    0

    Speeding up document publishing

    Hi,

    I'm wondering if publishing of a document would speed up when you would set less properties before publishing.

    My code at this time is

    dProduct.Text = product.PLU.ToString(); // Je moet ook de naam wijzigen als de omschrijving wordt gewijzigd
    dProduct.getProperty("pLU").Value = product.PLU;
    dProduct.getProperty("barcode").Value = product.barcode;
    dProduct.getProperty("price").Value = product.price;
    dProduct.getProperty("percentage").Value = product.percentage;
    dProduct.getProperty("weight").Value = product.weight;
    dProduct.getProperty("size").Value = product.size;
    dProduct.getProperty("stock").Value = product.stock;
    dProduct.Publish(umbraco.BusinessLogic.User.GetUser(0));
    umbraco.library.UpdateDocumentCache(dProduct.Id);

    But only the stock-amount changes regularly. Would it be faster to check whether the other properties are changed and only set the stock-property if nothing else has changed.

    Hope somebody has an answer, thanks in advance.


    Jeffrey

     

  • Grant Thomas 291 posts 324 karma points
    Oct 26, 2012 @ 14:19
    Grant Thomas
    0

    Your system will have a very accurate answer... did you ask it and what did it say? (i.e. did you try running both compositions of the equivalent method over n interations and what were the profiling results?)

  • Jeffrey Schoemaker 408 posts 2138 karma points MVP 8x c-trib
    Oct 26, 2012 @ 14:25
    Jeffrey Schoemaker
    0

    Hi Grant,

    good point :) But I'm on a testing-environment with a lot of other developers, and the timing wouldn't be very accurate.

    Greetings,

    Jeffrey

  • Grant Thomas 291 posts 324 karma points
    Oct 26, 2012 @ 14:32
    Grant Thomas
    0

    What do you mean? It would be exactly accurate as all the times will be relative to the system. It's not about getting accurate times of how long X will take in a "real" environment, it's the comparison of the time it takes X over Y where the results will be relative and transferable: say X takes 30secs on staging, Y takes 1min consistently, then it follows, all else being equal, that even with better hardware X will take less time on production than Y.

  • Stephen 767 posts 2273 karma points c-trib
    Oct 26, 2012 @ 18:54
    Stephen
    0

    Each time you set a value, it is written to the database.

    When you publish, all values are fetched from the database to create an XML representation of the content.

    So yes, in theory, just setting the properties that haven't change should be faster.

Please Sign in or register to post replies

Write your reply to:

Draft