sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    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.
    • thomthomT Offline
      thomthom
      last edited by

      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
      • tbdT Offline
        tbd
        last edited by

        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
        • thomthomT Offline
          thomthom
          last edited by

          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

            @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
            • tbdT Offline
              tbd
              last edited by

              @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
              • AdamBA Offline
                AdamB
                last edited by

                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
                • thomthomT Offline
                  thomthom
                  last edited by

                  @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

                    @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