|
Re: Data_Make_Struct Considered Dangerous?: msg#01223lang.ruby.general
ts <decoux@xxxxxxxxxxxxxx> wrote: --------------------------------------------- > Please be serious, this just add a test > if (ptr->data2) rb_gc_mark(ptr->data2); --------------------------------------------- Sure, for one line it is a joke. However, if this line is called hundreds of thousands times (such as if we have thousands of this kind of object), it makes a difference. Also, as much as possible, we should not have this line in the first place, i.e, if ptr->data2 is a VALUE, we must have this line; if it is pure C struct, then gc needs not to bother with them. My numbers are my witness: Pure Ruby : 31,000 events/sec Straight Ruby-to-C translation : 160,000 events/sec Some Ruby-C way : 222,000 events/sec (So far) The Furthest Ruby-C way: 312,000 events/sec ---------------------------------------------- > You have just learned that you don't know how to use the ruby API, and > perhaps ruby is not appropriate for your job (I've never understood what > you're trying to do). > Personnaly, when I use GA they are written in C and not in ruby, because > my simulations can run more than a week. > But I'll never say the stupid thing that you've said, because I've tried > *to learn* the ruby API before using it, something that apparently you > have forgotten to do. ---------------------------------------------- Common, be serious too. Where can you learn the ruby API? The Ruby pick-axe book? The corresponding README file? If the answer is to read the whole source code, I have better things to do. And if everybody reads the whole source, this newsgroup is never filled with questions regarding the Ruby C API and all those Ruby books will not sell. Using the Ruby-C way, currently my simulation can run for more then 3 days with stable memory. Whatever people say about one way or another, I stand by my numbers. Currently the objective is to achieve close to 1 million events/sec. So far the bottlenecks are the Ruby gc, the mark functions, and memory allocation/deallocation. So one objective in the software architecture will be to be able to run the code with GC.disable. Bill
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: ambiguity backtrack - accessors and persistent locals, dblack |
|---|---|
| Next by Date: | Glade Shortcut Keys, Tom Sawyer |
| Previous by Thread: | Re: Data_Make_Struct Considered Dangerous?, ts |
| Next by Thread: | Re: Data_Make_Struct Considered Dangerous?, Paul Brannan |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |