Wher writing CLI scritps I try to keep the fetch on the "outside of the for/foreach" as small as possible.
Best way would be a SQL fetch with all the nodes I need. (The advantage is: I can use LIMIT to run the script for a part of the result. Change the offset and append the next result to the output file.)
If You need to use the fetch functions, I would try the 'load_data_map' paramter like this:
@Bertrand which kind of changes are you talking about, regarding eZPersistentObject? Is this for the 4.3 development cycle? Or for "Project V"? I did not see anything about this on the roadmap.
ProjectV ? Never heard of that. I've heard of Big Balls though. End of private joke.
This change is something we've been talking about, and I also know it has already been partially implemented by a member of the team. There is nothing concrete yet, but it is clear that managing in-memory cache the way we currently do in eZ is a poor approach. This needs to be consolidated with a system wide API, but it's definitely not my role to decide when it is gonna be done. Sorry :(