Announcement

Collapse
No announcement yet.

How much do these functions/processes weigh, as in, how processor intensive are they?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How much do these functions/processes weigh, as in, how processor intensive are they?

    I'm curious about how much the empressa engine has to work on the following:

    1. To use miva_variable_Value(...) a lot

    2. To use "l.something CIN l.something_else" or "tolower(l.something) IN tolower(l.something_else)"

    3. MvWHILE vs MvFOREACH

    4. Using a lot of big global variable structures vs passing local reference variables to functions

    5. Using readytheme content sections vs executing compiled page templates

    Is there a document or something that shows all the miva functions/tags listed in order of how "heavy" they are for empressa to deal with? I am curious about what the most heavy processes are so I can avoid them if possible in my coding.
    M.A.D.* since 1997

    http://www.scotsscripts.com

    *miva application developers

    #2
    1. I would avoid using miva_variable_value as much as possible. The engine has to parse the string you pass to it every time and lookup the variable. If you are able to use MvREFERENCEARRAY or similar all the parsing is done at compile time instead of runtime. With that being said, unless you are running miva_variable_value tens of thousands of times per page load I don't think you'll see too much of an impact.
    2. <x> CIN <y> is probably going to be technically faster but you'd never be able to measure it.
    3. They are essentially the same concept and you'd again probably never be able to measure a difference. Using the COUNT attribute on MvFOREACH would help out if you're using that tag a lot.
    4. There shouldn't be an difference really.
    5. Probably not going to be a big difference again unless you're doing a ton per page load.
    You could use mvprof to profile your code and see what is taking the most amount of time.
    David Carver
    Miva, Inc. | Software Developer

    Comment


      #3
      David,

      You could use mvprof to profile your code and see what is taking the most amount of time.
      MvProf? I don't recall if I've heard of it. What? When? Where? How? etc...

      I've had recent needs for a tool like this.

      Scott
      Need to offer Shipping Insurance?
      Interactive Design Solutions https://www.myids.net
      MivaMerchant Business Partner | Certified MivaMerchant Web Developer
      Competitive Rates, Custom Modules and Integrations, Store Integration
      AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
      My T-shirt Collection is mostly MivaCon T-shirts!!

      Comment


        #4
        Looks like MvPROF is a windows tool:

        https://docs.miva.com/videos/install-the-compiler

        Is there one for linux?
        M.A.D.* since 1997

        http://www.scotsscripts.com

        *miva application developers

        Comment


          #5
          #2

          Really? Maybe its bad memory but in my head is an old post from the icon Ivo Truxoff, who did a test. I think he used about 1,000 instances of 'x' CIN y compared to tolower('x') IN y and the later was at least %20/%30 faster.
          Last edited by Bruce - PhosphorMedia; 12-01-20, 10:38 AM.
          Bruce Golub
          Phosphor Media - "Your Success is our Business"

          Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
          phosphormedia.com

          Comment


            #6
            David,

            You could use mvprof to profile your code and see what is taking the most amount of time.
            OK, found the programs, Thanks Scot.

            Nothing seems to be obvious. What is the typical usage? For example, If I wanted to run these utils(mvcov, mvprof) on "mycompiledmodule.mvc."

            Scott


            Need to offer Shipping Insurance?
            Interactive Design Solutions https://www.myids.net
            MivaMerchant Business Partner | Certified MivaMerchant Web Developer
            Competitive Rates, Custom Modules and Integrations, Store Integration
            AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
            My T-shirt Collection is mostly MivaCon T-shirts!!

            Comment


              #7
              Originally posted by Bruce - PhosphorMedia View Post
              #2

              Really? Maybe its bad memory but in my head is an old post from the icon Ivo Truxoff, who did a test. I think he used about 1,000 instances of 'x' CIN y compared to tolower('x') IN y and the later was at least %20/%30 faster.
              I could be wrong, but I would imagine CIN would be faster because that automatically lowers the values for you and saves you 2 function calls to tolower() at the MivaScript level. So it saves you those function calls and their overhead to call them.
              David Carver
              Miva, Inc. | Software Developer

              Comment


                #8
                ah, that makes sense. sure is easier to type. :)
                Bruce Golub
                Phosphor Media - "Your Success is our Business"

                Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                phosphormedia.com

                Comment


                  #9
                  You would do roughly this:

                  https://www.miva.com/forums/forum/de...ript-debug-log

                  which breaks down to:

                  1) Set your Empresa or Mia to have cookie-based logging, or just log everything if it's not a production website or internet accessible
                  2) Place diagtool.mvc on the site to assign your browser a unique cookie name matching what you set the log cookie to
                  3) Remove any prior log
                  4) Perform the request to the script you want to profile
                  5) Copy out the log before making any further requests
                  6) Run mvprof against the log file to generate the report on the functions that were called, iterations, time consumed by processing, etc.
                  7) Turn off logging when done

                  David Hubbard
                  CIO
                  Miva
                  [email protected]
                  http://www.miva.com

                  Comment


                    #10
                    Originally posted by Bruce - PhosphorMedia View Post
                    #2

                    Really? Maybe its bad memory but in my head is an old post from the icon Ivo Truxoff, who did a test. I think he used about 1,000 instances of 'x' CIN y compared to tolower('x') IN y and the later was at least %20/%30 faster.
                    We haven't heard from Ivo in quite a while. The tests you're thinking of may have been done with the earlier, non-compiled version of the VM.
                    Kent Multer
                    Magic Metal Productions
                    http://TheMagicM.com
                    * Web developer/designer
                    * E-commerce and Miva
                    * Author, The Official Miva Web Scripting Book -- available on-line:
                    http://www.amazon.com/exec/obidos/IS...icmetalproducA

                    Comment


                      #11
                      I don't think I'd rely on data from Ivo almost 15 years after the fact; it's easy to test with logging and mvprof.
                      David Hubbard
                      CIO
                      Miva
                      [email protected]
                      http://www.miva.com

                      Comment

                      Working...
                      X