Can Ruby use multicore?
-
I don't understand much of this, but it seems that we can benefit of multithreading with ruby scripts. http://phrogz.net/ProgrammingRuby/tut_threads.html
If true, than several plugins could be enhanced to do their job much faster. As I said, I'm not so skilled in ruby , so maybe someone more skilled will take a look and say if it it possible to use multithreading or not.good day and I hope it wasn't just a false alarm...
-
I dont know the details of it myself, but im pretty sure you cant use threads properly in SU ruby. Might be worth asking TBD about it, as i seem to remember him explaining it at some point.
-
@remus said:
I dont know the details of it myself, but im pretty sure you cant use threads properly in SU ruby. Might be worth asking TBD about it, as i seem to remember him explaining it at some point.
I remember also a discussion about forcing sketchup to use multiple cores by using ruby, but the answer was NO, it can not be possible. What I'm wondering is if ruby plugins could benefit of multiple cores, by themselves? Because some plugins perform complex operations and can take very long time to finish their job.
-
it is not possible as Ruby has a Global Interpreter Lock - check concurrency-is-a-myth-in-ruby and multi thread scaling issues with python and ruby.html for an explanation
in short: no, as Ruby uses just 1 native OS thread so you cannot have multi core processing, you just have parallelism using Ruby thread - good for some things but it will not make your code faster.
@newone said:
some plugins perform complex operations and can take very long time to finish their job.
split the code and do the calculations in an extension using native threads
-
@unknownuser said:
split the code and do the calculations in an extension using native threads
Agree, far more efficient way.
-
@notareal said:
@unknownuser said:
split the code and do the calculations in an extension using native threads
Agree, far more efficient way.
If only I undersstood what it meant.....
Chris
-
i think theyre talking about writing your program to run outside SU on native, proper threads then getting it to talk to SU.
-
extension = code in another language brought in Ruby world. for example, my dezip is an extension that brings unzip capabilities to SU Ruby
the egg and chicken problem - SU is an extension to Ruby
Advertisement