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. Are there any general rules of thumb that you use when writing extensions? My first problem was trying to figure out what should remain Ruby code and what should be moved out to C. For example, if I opened the file that contained binary data in Ruby, how could I "get" to that data using a FILE pointer in C? Or should I just pass the filename to the C extension? Also, I couldn't really figure out how to only have one function in C, the documentation seemed to say that I needed to have a class? Thanks, Joe