All of lore.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] RFC: New todo for loops
Date: Sun, 18 Dec 2005 14:34:38 +0000	[thread overview]
Message-ID: <43A5737E.2040204@bfs.de> (raw)
In-Reply-To: <20051218142953.a30dcf5d.daniel.marjamaki@comhem.se>

Hi daniel,
  i do not like the idea. the code is harder to read and debug, smashing 
pointers is easy done. i would not trade that for speed.

SFIK, array[i] is read as *(array+i) with c-compilers. nice example is 
in "how to write unmaintainable code".


re,
  walter


Daniel Marjamäki wrote:
> Hello friends!
> 
> I have a suggestion for the TODO.
> Making loops faster is important. Therefore in the loops we should use pointers instead of arrays.
> 
> Example (fs/reiser/file.c:268):
> 	int i;
> 	for (i = 0; i < blocks_to_allocate; i++)
> 		allocated_blocks[i] = cpu_to_le32(allocated_blocks[i]);
> 
> This could be changed to something like:
> 	struct b_blocknr_t *block, *block_last;
> 	block_last = &allocated_blocks[allocated_blocks-1];
> 	for (block = allocated_blocks; block <= block_last; block++)
> 			*block = cpu_to_le32(*block);
> 
> Best Regards,
> Daniel Marjamäki
> 
> _______________________________________________
> Kernel-janitors mailing list
> Kernel-janitors@lists.osdl.org
> https://lists.osdl.org/mailman/listinfo/kernel-janitors
> 
> 
> 
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

      parent reply	other threads:[~2005-12-18 14:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-18 13:29 [KJ] RFC: New todo for loops Daniel Marjamäki
2005-12-18 13:44 ` Matthew Wilcox
2005-12-18 14:08 ` Ricardo Nabinger Sanchez
2005-12-18 14:34 ` walter harms [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43A5737E.2040204@bfs.de \
    --to=wharms@bfs.de \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.