[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Microoptimization of lib/poll.c
From: |
Bruno Haible |
Subject: |
Re: [PATCH] Microoptimization of lib/poll.c |
Date: |
Wed, 6 Aug 2008 15:12:04 +0200 |
User-agent: |
KMail/1.5.4 |
Paolo Bonzini wrote:
> I actually noticed these in a profile!
What tool do you use for doing profiling on a per-line or per-instruction
basis? The Google profiler?
> 3) access to thread-local errno is slow, it's also better to cache it.
Pheww! That is micro-optimization indeed.
Do you have an objection against this further patch? Should save 2 instructions
in the case that you were not profiling.
--- lib/poll.c.orig 2008-08-06 15:11:42.000000000 +0200
+++ lib/poll.c 2008-08-06 15:07:43.000000000 +0200
@@ -55,7 +55,7 @@
int timeout;
{
fd_set rfds, wfds, efds;
- struct timeval tv = { 0, 0 };
+ struct timeval tv;
struct timeval *ptv;
int maxfd, rc;
nfds_t i;
@@ -91,7 +91,11 @@
/* convert timeout number into a timeval structure */
if (timeout == 0)
- ptv = &tv;
+ {
+ ptv = &tv;
+ ptv->tv_sec = 0;
+ ptv->tv_usec = 0;
+ }
else if (timeout > 0)
{
ptv = &tv;