[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: On the performance of octave_usleep/gnulib::nanosleep on Win32
From: |
Michael Goffioul |
Subject: |
Re: On the performance of octave_usleep/gnulib::nanosleep on Win32 |
Date: |
Mon, 21 Nov 2011 08:35:14 +0000 |
On Mon, Nov 21, 2011 at 6:23 AM, John W. Eaton <address@hidden> wrote:
> Yes, since part of the reason for gnulib is to avoid the need for
> #ifdefs like that, I think the gnulib code should be fixed instead.
> What does it do on Windows systems that is worse than Sleep.
I think it's the setting up of the sleep functionality that is
CPU-consuming. Calling a single long octave_usleep does not consume
CPU, but calling a lot of short octave_usleep does.
> Is there
> some reason it can't call Sleep?
Time resolution. The gnulib nanosleep function is to get very fine
resolution, while Sleep only offers >1ms resolution. The gnulib code
uses Sleep when the sleep delay is >= 1s, otherwise it uses some
internal implementation. The problem arises when you don't need
nanoscale resolution, but the delay is <1s and you call it repeatedly.
I'll report the issue on gnulib mailing list.
Michael.