• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

Compile Ruby code?

Scheduled Pinned Locked Moved Developers' Forum
8 Posts 4 Posters 631 Views 4 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    thomthom
    last edited by 11 Jun 2009, 12:02

    From http://code.google.com/intl/nb/apis/sketchup/docs/faq.html - "My script is slow. How can I improve performance?"

    @unknownuser said:

    Use a compiled Ruby extension module to do the work in compiled code.

    How do you do that?

    Thomas Thomassen — SketchUp Monkey & Coding addict
    List of my plugins and link to the CookieWare fund

    1 Reply Last reply Reply Quote 0
    • T Offline
      tbd
      last edited by 11 Jun 2009, 12:11

      you don't compile Ruby code, you need to write the code in C (or other language that creates a DLL on Windows). take a look at http://www.rubyinside.com/how-to-create-a-ruby-extension-in-c-in-under-5-minutes-100.html

      SketchUp Ruby Consultant | Podium 1.x developer
      http://plugins.ro

      1 Reply Last reply Reply Quote 0
      • T Offline
        thomthom
        last edited by 11 Jun 2009, 12:20

        Ah. I had seen some .so files some times and I thought maybe these where "compiled ruby scripts".

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • T Offline
          tomasz
          last edited by 11 Jun 2009, 17:46

          @unknownuser said:

          you don't compile Ruby code, you need to write the code in C (or other language that creates a DLL on Windows)

          What about Mac? Is it more complicated?

          Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

          1 Reply Last reply Reply Quote 0
          • T Offline
            tbd
            last edited by 11 Jun 2009, 18:02

            @unknownuser said:

            What about Mac? Is it more complicated?

            if you don't use Windows specific code than you just compile for Mac and done. in the article it said "this was all tested on OS X" 😉

            SketchUp Ruby Consultant | Podium 1.x developer
            http://plugins.ro

            1 Reply Last reply Reply Quote 0
            • A Offline
              AdamB
              last edited by 11 Jun 2009, 18:38

              But before you go down the C++ route, I'd really suggest looking carefully at your Ruby and ensuring its as fast as it can be.

              Make sure you're not creating lots of objects. Make sure you cache intermediate results. Make sure you don't use the fancy Ruby expressions for loops which are slow. Make sure you avoid at all costs any Struct stuff which is insanely slow.
              And on..

              Adam

              Developer of LightUp Click for website

              1 Reply Last reply Reply Quote 0
              • T Offline
                thomthom
                last edited by 11 Jun 2009, 18:48

                @adamb said:

                Make sure you don't use the fancy Ruby expressions for loops which are slow.

                Which are these?

                @adamb said:

                Make sure you avoid at all costs any Struct stuff which is insanely slow.

                Structs?

                I'm not planning on compiling C++ stuff, not my cup of tea. I was just curious about this "compiled ruby" stuff.

                Thomas Thomassen — SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund

                1 Reply Last reply Reply Quote 0
                • T Offline
                  tomasz
                  last edited by 29 Jul 2009, 20:05

                  @unknownuser said:

                  take a look at http://www.rubyinside.com/how-to-create-a-ruby-extension-in-c-in-under-5-minutes-100.html

                  I am on completely unknown territory and have stopped on the 'make' command.
                  I presume it is the command responsible for compiling the C code with the makefile created in a previous step.

                  I would like to recreate the MyTest in VC++ 2008 Express Edition... and I am lost. I will dig through internet to understand the whole process, but if someone can explain me in few words how to compile the example with VC++2008 will be thankful.

                  Tomasz

                  Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post
                  Buy SketchPlus
                  Buy SUbD
                  Buy WrapR
                  Buy eBook
                  Buy Modelur
                  Buy Vertex Tools
                  Buy SketchCuisine
                  Buy FormFonts

                  Advertisement