more laziness clarification

This commit is contained in:
Brian Lopez 2010-05-16 00:28:10 -07:00
parent 82c40620ad
commit b82e307931
1 changed files with 2 additions and 0 deletions

View File

@ -109,6 +109,8 @@ Field name strings/symbols are shared across all the rows so only one object is
Rows themselves are lazily created in ruby-land when an attempt to yield it is made via #each.
For example, if you were to yield 4 rows from a 100 row dataset, only 4 hashes will be created. The rest will sit and wait in C-land until you want them (or when the GC goes to cleanup your Mysql2::Result instance).
Now say you were to iterate over that same collection again, this time yielding 15 rows - the 4 previous rows that had already been turned into ruby hashes would be pulled from an internal cache, then 11 more would be created and stored in that cache.
Once the entire dataset has been converted into ruby objects, Mysql2::Result will free the Mysql C result object as it's no longer needed.
As for field values themselves, I'm workin on it - but expect that soon.