Message152410
| Author |
pitrou |
| Recipients |
hynek, jcea, ncoghlan, neologix, pitrou, rosslagerwall, tarek |
| Date |
2012年01月31日.21:56:14 |
| SpamBayes Score |
3.610086e-06 |
| Marked as misclassified |
No |
| Message-id |
<1328046829.20847.1.camel@localhost.localdomain> |
| In-reply-to |
<CAH_1eM3xYiGgA4q70Y=-15W=HRNsbgqZ5uzt4SA1rq6EshyPbw@mail.gmail.com> |
| Content |
> I was a little worried about the performance impact, so I did some
> trivial benchmarks:
> - O(depth) fwalk() is actually a tiny bit faster than walk() (it may
> be because we don't do as much path lookup)
> - O(1) fwalk() is around 20% slower, on a pure-traversal benchmark (so
> in a realistic use case where we would actually do something with the
> values returned by fwalk() the difference shouldn't be that
> noticeable)
I think the O(depth) version is fine. The O(1) version is quite more
complicated, difficult to follow, and it seems less robust (it doesn't
use try/finally and therefore might leak fds if the generator isn't
exhausted before being destroyed).
On modern systems you have at least 1024 fds, so the restriction
shouldn't be a problem. |
|