[racket-dev] Why did DrDr get much slower?
At Sat, 13 Jul 2013 10:55:20 -0400, Sam Tobin-Hochstadt wrote:
> On Sat, Jul 13, 2013 at 10:44 AM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
> >
> > This slowdown seems to be real on my machine as well --
> > realm/chapter2/source.rkt runs more than twice as slow in rev bd09a60e
> > as it does in v5.3.5. I'm testing the revision right before
> > `filesystem-change-evt` now.
>
> The slowdown is indeed at the revision where `filesystem-change-evt`
> was introduced, at least on my Linux x64 machine.
It looks like inotify() operations are slow on some installations.
The program below takes little CPU time, but on some machines that I've
tried, it takes many tens or even hundreds of milliseconds in real
time. On those machines, Racket ends up waiting around a lot for
inotify() to set up filesystem watches on collection-link files.
For now, I've disabled inotify()-based `filesystem-change-evt'.
----------------------------------------
#include <sys/inotify.h>
#include <stdio.h>
#include <errno.h>
#define N 1
int main()
{
int fd, wd;
int i;
for (i = 0; i < N; i++) {
fd = inotify_init();
if (fd == -1) printf("failed %d\n", errno);
wd = inotify_add_watch(fd, "a.out",
(IN_CREATE | IN_DELETE | IN_DELETE_SELF
| IN_MODIFY | IN_MOVE_SELF | IN_MOVED_TO
| IN_ATTRIB | IN_ONESHOT));
if (wd == -1) printf("failed %d\n", errno);
close(fd);
}
return 0;
}