Load vs Require

Hello all!
Is there any difference between using Load and Require?
These two methods have the same performance?

Thank you for your answers.

Best regards,
Hugo

On 2006.01.28 20:02, Hugo wrote:

Hello all!
Is there any difference between using Load and Require?
These two methods have the same performance?

#load always loads and interprets the file in question,
whereas #require will only do it the first time around
(filenames required earlier in $" or $LOADED_FEATURES).
This is very useful if you have a file that might change
while the program is running.

Here the two methods have distinctly different effects,
so efficiency should not really be a factor–just use
#load only when above behaviour is desired.

(And, in general, worry about performance only after
you have profiled your program and identified the
bottlenecks :slight_smile:

Thank you for your answers.

Best regards,
Hugo

E

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs