Document your code

Every project on GitHub comes with a version-controlled wiki to give your
documentation the high level of care it deserves. It’s easy to create
well-maintained, Markdown or rich text documentation alongside your code.

Benchmarks

This is a list of benchmarks done as experiments to determine whether or not to change certain pieces of code.

tree_for: using WHERE IN(...) vs Model.find_by_sql(query)

Parameters: Retrieve root nodes with 50 descendants 1000 times.

Results:

Query

WHERE IN (...)

Model.find_by_sql(query)

Execution time (real)

0.010050

0.015138

I've run this several times and WHERE IN (...) is faster each time. However, it doesn't create the row objects like find_by_sql does, and it only retrieves the ID of each row, which essentially causes another trip to the database when you go to use the data. I'm not very concerned as I'd rather have functionality that can be optimized later instead of what I have now, which causes a lot of hackiness in order to retrieve other columns in other places in the code.