Hi, On Sunday 24 January 2010, Marco Barbàra wrote: > After the first execution this command takes approximately this amount of > time. And if I launch it for i in 1:1000000 it takes more than 85 > seconds, compared to 1.2 seconds if launched just after rkward started. > Closing and restarting rkward makes this behavior reproducible. > > Is that normal? I do not think so.
yes, this is a bit embarassing, but it's a known problem. We have a report about it at http://sourceforge.net/tracker/?func=detail&aid=1810061&group_id=50231&atid=459010 . The problem is, that R provides no direct mechanism to find out, when an object has changed. To detect this happening, we replace all objects in the global environment with so-called active bindings, every time a command has finished. This means, the second time the loop runs, "i" is an active binding, and each assignment to it incurs a small hit penalty. In a long for-loop, this can become quite noteable. Workarounds include: - Running the loop inside a local ({})-statement as shown in the above report - Removing "i" before running the loop - Defining the loop inside a function, then calling this function I'm sure we can do better at this point, and we will, eventually, but we have a long list of things we want to work at, and only a limited amount of time... Many thinks for taking the time to report this, though! Regards Thomas
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com
_______________________________________________ RKWard-devel mailing list RKWard-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rkward-devel