il 23 May 2004 22:21:12 -0700, dlissett0 / yahoo.com (Duncan Lissett) ha scritto:: >I'd appreciate any suggestions on how to make a faster Ruby >implementation of Richards benchmark. Perhaps there are obvious >problems that can be corrected? > >http://www.lissett.com/ben/bench1.htm this: class Scheduler @table @list @currentTcb @currentId @v1 @v2 @queueCount @holdCount def initialize() @table = Array.new(MAXTASKS,nil) @list = nil @queueCount = 0 @holdCount = 0 end is not what you think, I believe :) You can remove the @vars, at the top, leave thos in the method calls. you don't need to show to ruby that they're instance variables the @ does this already :) then remove the useless (). And the useless 'then's and 'return's Next, I believe you could use attr_accessor for *many* variables. And use a Task superclass will make the code much shorter I believe :) Using Array.at(someIndex) is slightly faster than array[someIndex]. And I believe there is a linked list to handle a queue that probably could be replaced from a normal Array. Anyway, I believe that code should be rewritten from the specs, more than just 'ported' from some other language. hope this helps.