Performance of UDF Function ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hvsummer
    New Member
    • Aug 2015
    • 215

    Performance of UDF Function ?

    I know it's silly to ask this, but since I did not study any basis in Computer-code so I have 1 question about performance

    1 big function contain every part on it
    or combined multi function with each piece specialize to do its job

    what method will be faster ?
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    Not an easy question to answer...

    This would most likely depend upon the function and overall application.

    In general, the more complex the code, the more of an impact one might expect; however, with today's desktop/laptop pc's the impact might not be noticeable to the end user. Also, once compiled, the impact is less noticeable.

    With that said, "your mileage may vary."

    Comment

    • TheSmileyCoder
      Recognized Expert Moderator Top Contributor
      • Dec 2009
      • 2322

      #3
      With multiple functions you will be passing around parameters, either ByVal or byref. So there is slightly more processing with multiple functions, as those variables are passed around, assigned to memory and cleaned up again.

      However, the performance impact is often so small as to be completely neglible. Often we talk about whether it takes 50 mili-seconds or .55 miliseconds. Both appear instantaneous to the user, i.e. the user can not tell the difference.

      But the readability and maintainability of your code is often increased significantly by dividing your code into more sections and/or functions.

      In my experience the benefit of the maintainability far outweighs the performance in 95% of cases.

      Also, don't spend time to optimize performance until you know you need to. Sure there is alot of code that could be optimized for 10% better performance, but the truth is that we very rarely need to.

      Comment

      • hvsummer
        New Member
        • Aug 2015
        • 215

        #4
        @zmbd ok, I got it, thank you.
        @The Smileycoder:
        Well, actually, I'm on the way coding the multi-split-function for excel/access. And already finished all small parts, I'll rewrite the main function to use each part to co-op together.
        I'll post it to insight section When I finish. (I did post 1 upgraded function that I copy from another guy in internet, still keep his name inside function and added my name to it.)

        Comment

        Working...