Combined methods slow down

Hello everyone!

A very simple situation puzzles me for long, and I wonder if someone could help me.

I have two methods and would like to run them sequentially.
When I run sf_menu_Method1() and sf_menu_Method2() individually, they execute quickly (around 0.1 seconds).
However, when I run the combined method sf_menu_MethodAll(), it becomes significantly slower (around 20 seconds).

    def self.sf_menu_Method1()
     Method1( sf_defaults )

    def self.sf_menu_Method2()
     Method2( sf_defaults )

    def self.sf_menu_MethodAll()
     Method1( sf_defaults )
     Method2( sf_defaults )

These methods involve about 2800 components, I think this should not rise memory issues.
(System resources -CPU,Memory- are under 50% usage)

What could cause the slow down of the combined method?

(1) Method names are lowercase by convention.

  • Your example has Sentence case method names that do not exist in the example.

(2) Singleton methods (def self.method_name) need to be within a module or class.

(3) It is impossible to give you any valid response as we do not know what sf_defaults() or any other of your methods do, other than they “involve about 2800 components”.

(4) It matters what SketchUp version you are seeing issues on as the Ruby version changes every few releases and bugs do get fixed. So giving a general situation of “A very simple situation puzzles me for long” is ridiculous!

There’s not enough information in your post to know. I can think of various possibilities, but with no idea what your code actually does, I can’t choose among them.