Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #7728
| Path | csiph.com!aioe.org!.POSTED!not-for-mail |
|---|---|
| From | Victor Porton <porton@narod.ru> |
| Newsgroups | comp.programming |
| Subject | for-loops in the main function or in the subfunctions? |
| Date | Wed, 19 Apr 2017 23:48:09 +0300 |
| Organization | Aioe.org NNTP Server |
| Lines | 19 |
| Message-ID | <od8ien$1ln1$1@gioia.aioe.org> (permalink) |
| NNTP-Posting-Host | HO54yo/wQJHrp4blb7RQ6A.user.gioia.aioe.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Complaints-To | abuse@aioe.org |
| User-Agent | KNode/4.14.10 |
| X-Notice | Filtered by postfilter v. 0.8.2 |
| Xref | csiph.com comp.programming:7728 |
Show key headers only | View raw
I write a function (or rather an OO method) which generates a list of errors for a set of transactions (for a moment forget what exactly the word "transaction" means, it is irrelevant for my question). Some errors are per-transaction and some are characterization of the entire set of transactions (for example, they may depend on the sum of the paid values for all transactions in the set). Should I make for-loop iterating the transactions in the set in my main function or make such loops in the sub-functions which I call (directly or indirectly) from the main function? The first variant (to put the loops into the main function) is a bit shorter and a tiny bit faster. However I am unsure about advantages of the second variant (to put the loops into the sub-functions rather than in the main function). -- Victor Porton - http://portonvictor.org
Back to comp.programming | Previous | Next — Next in thread | Find similar | Unroll thread
for-loops in the main function or in the subfunctions? Victor Porton <porton@narod.ru> - 2017-04-19 23:48 +0300 Re: for-loops in the main function or in the subfunctions? Julio Di Egidio <julio@diegidio.name> - 2017-04-19 15:04 -0700
csiph-web