Brain-scratcher: likely a bug - please help me confirm and fix. Seems to only affect exw.exe
- Posted by CladStone Jun 13, 2009
- 1018 views
While benchmarking some procedures, I noticed some crazy timings that didn't make sense of what I expected, so I reduced the complexity of the code while trying to maintain the problem, and got it down to just a few lines.
To help you try to duplicate my problem, here are some things you should know:
- I'm on Windows XP Home SP3, 2.8GHz Pentium 4, 2GB RAM, Intel Mobo, FAT32 hard drives.
- I reinstalled Euphoria 3.1.1 and got the same problem.
- I installed an earlier version (2.5) and got the same problem.
- I only reproduced the problem using exw.exe. EX.EXE runs both at the same slow speed.
- It's crazy, but the filename matters. Some filenames make the problem disappear. Others flip the problem in the opposite way. For now, name the file "euphbug.exw"
- I don't think the path matters, but to make sure, just put it at "C:\".
- Enter the following code exactly. Don't use any extra lines (yes, in many of my tests, the problem was affected by simply having or not having certain blank lines, unused constants/variables, extra comments, etc.)
constant p = machine_func(16, 1) constant f = machine_func(16, 24) poke(f, #C3) for i = 1 to #800000 do call(f) poke(p, 0) end for machine_proc(26, 0)
Code explanation:
- I start out by allocating two small buffers [machine_func(16, x) = allocate(x)].
- I poke in a program at the second buffer to call later. [#C3 = Return, about as short as it gets]
- To make the timing measurable, I put a couple lines of code in a for loop. Two simple lines of code that repeat.
- As soon as the loop completes, machine_proc(26, 0) generates a console window and waits for a keypress before closing.
The problem:
- Run the file with exw.exe
- The console window appears almost instantly, as expected.
- On line 2, change the 24 to 25, save and run it again.
- The console window is delayed about 2 seconds.
Next test:
- Rename the file "euphbug01.exw"
- Try with 24 and 25. Both make the console window appear immediately.
- Rename the file "euphbug01.ew"
- Try with 24 and 25. Now 24 is the one delayed a couple seconds, while 25 finishes immediately.
Other stuff:
- I've had the problem, in one form or another, regardless of "without type_check" and "without warning" statements.
- There's all sorts of things you can experiement with and manipulate in this file that will give you the fast or the slow running time, but I haven't been able to recognize a pattern to it.
Thanks in advance for the HELP!