I make one file per class, except classes that are small helper classes, not needed by other files. I separate my different modules in subdirectories also.
The difference between load
and require
is require
will only load the file once, even if it's called multiple times, while load
will load it again regardless of whether it's been loaded before. You'll almost always want to use require
, except maybe in irb
when you want to manually want to reload a file.
I'm not sure on the performance hit. When you load
or require
a file, the interpreter has to interpret the file. Most Ruby's will compile it to virtual machine code after being required. Obviously, require
is more performant when the file may have already been included once, because it may not have to load it again.