From: Joe Van Dyk Date: 2005-04-05T00:17:13+09:00 Subject: Re: Extension question On Apr 4, 2005 7:46 AM, Tom Copeland wrote: > On Mon, 2005-04-04 at 23:19 +0900, Joe Van Dyk wrote: > > Hi, > > > > I'm generating a fairly large image file (can be 10000x10000) pixels > > by reading some binary data and setting each pixel. As you can > > imagine, pure Ruby is REALLY slow, I think because of the loops. I've > > written the program in C and it's literally hundreds to thousands of > > times faster (depending on image size). > > > > So, I'd like to write my first C extension. I'm using the GD library > > for image manipulation. > > You might be interested in this: > > http://raa.ruby-lang.org/list.rhtml?name=ruby-gd > > >From the example scripts: > > require "GD" > im = GD::Image.new(100,100) > red = im.colorAllocate(255,0,0) > im.rectangle(0,0,99,99,red) > im.png STDOUT > > Yours, Hi, I was using Ruby-GD before. The slowness is not the library, but the looping 10 million times. I have to set each pixel, so I can't use the rectangle function.