Review Request: Four simple patches for kdecore
Rolf Eike Beer
kde at opensource.sf-tec.de
Sun Nov 7 18:31:33 GMT 2010
Dawit Alemayehu wrote:
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://svn.reviewboard.kde.org/r/5775/#review8543
> -----------------------------------------------------------
>
>
> I am personally not conveinced the need for changing from usleep to
> nanosleep in this particular instance. IOW, usleep is sufficient in this
> case to warrant a change regardless of when that system call was made
> available...
>
>
> /trunk/KDE/kdelibs/kdecore/util/kshareddatacache.cpp
> <http://svn.reviewboard.kde.org/r/5775/#comment8911>
>
> Hmm... why do unnecessary calculations in fast loops ? Surely
> "1<<21*10" can be hard coded with a #define.
>
>
>
> /trunk/KDE/kdelibs/kdecore/util/kshareddatacache.cpp
> <http://svn.reviewboard.kde.org/r/5775/#comment8912>
>
> And of course if speed is an issue, which seemed to be the case since a
> left shift arithmetic was done above, this can be changed to a equivalent
> left shift operation:
>
> usecSleepTime.tv_nsec = usecSleepTime.tv_nsec << 1;
No, please don't do that. That advise is outdated some years. This doesn't get
any benefit at all since every compiler not completely outdated will generate
the same code from "a * 2" and "a << 1". They will also do precalculations of
constants. So this would also make the code unreadable.
See e.g. http://dl.fefe.de/optimizer-isec.pdf for more information on compiler
optimizations.
Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20101107/67db5447/attachment.sig>
More information about the kde-core-devel
mailing list