Hi, I have a script that runs over ~200,000 rows, creates an embedded document per row and adds each X embedded docs to a Document (5 embedded docs to a document by average). The script does other stuff as well.
At first, running the script took too long. Using profiler, I've noticed the
adding takes the majority time: report << item.
After debugging the code of '<<' function in 'many_embedded_proxy.rb', I've
noticed that each call to "Array(docs)" causes a 'missing_method' call which
activates 'define_attribute_methods' function.
I've tried to coat the embedded doc parameter myself before calling '<<' and
removed the following lines from the '<<' function:
def <<(docs)
load_target
#@reflection.verify_type!(Array(docs), @owner)
#assign_references(docs)
#@target += Array(docs)
@target += docs # instead of the previous line
self
end
And my script ran 10 times faster. I thought that removing these lines will
cause a problem to the 'save' method of the document, but the save went ok.
Am I missing something by removing these lines? Is there a problem with the
code?
Thanks,
[cid:[email protected]]
Yehuda Zargrov
Software Engineer
Conduit Your Site<http://www.conduit.com/>
t: +972.8.946.1713 ext +288 | m: +972503473119 | f: +97286382140
This message may contain confidential and/or privileged information. It is
intended to be read only by the individual or entity to whom it is addressed or
by their designee.
If the reader of this message is not the intended recipient, you are on notice
that any uses, copy, disclose or distribution of this message, in any form, is
strictly prohibited.
If you have received this message in error, please notify the sender by reply
email or by telephone and delete or destroy any copy of this message. Thank you.
<<inline: image001.png>>
_______________________________________________ riak-users mailing list [email protected] http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
