A
Albert Oppenheimer
I thought my program had to be caught in a loop, and cancelled it through
the task manager. It took about one second in Java, but re-implemented in
C, it had already run over one minute.
I set up a debugger to display the current location each loop and let it
run. It did reach completion, but it took 20 minutes.
I replaced the calls to wcschr in my program with calls to this substitute:
static WCHAR* altchr(register WCHAR* s, register WCHAR c) {
while (TRUE)
{ if (*s == c)
return s;
if (*s == 0)
return 0;
++s;
}
}
Now my program finishes instantly, faster than the Java version, as you
might expect.
What could wcschr be doing that takes so long???
I'm on XP, using the Borland 5.5.1 C++ compiler that can be downloaded free
from their web site.
the task manager. It took about one second in Java, but re-implemented in
C, it had already run over one minute.
I set up a debugger to display the current location each loop and let it
run. It did reach completion, but it took 20 minutes.
I replaced the calls to wcschr in my program with calls to this substitute:
static WCHAR* altchr(register WCHAR* s, register WCHAR c) {
while (TRUE)
{ if (*s == c)
return s;
if (*s == 0)
return 0;
++s;
}
}
Now my program finishes instantly, faster than the Java version, as you
might expect.
What could wcschr be doing that takes so long???
I'm on XP, using the Borland 5.5.1 C++ compiler that can be downloaded free
from their web site.