BYOND Version:497
Operating System:Windows 7 Pro 64-bit
Web Browser:Chrome 20.0.1132.57
Applies to:Dream Seeker
Status: Deferred

This issue may be low priority or very difficult to fix, and has been put on the back burner for the time being.
Descriptive Problem Summary:
I made a simple .dll file that has only one exported function which returns the text string "1".

Then I executed the following:
d = world.timeofday

for (var/i = 1 to 100000) call("mydll", "function")("5 + 5")

world.log << "Test took [world.timeofday - d] ticks."

The above test case takes 2 ticks, even though the DLL doesn't do any actual processing.

When the number goes even higher I end up having to wait 30 seconds. This seems odd since all this is supposed to be doing is calling a function that returns a static value.

I don't know if I'm doing anything wrong, so if I am please point that out. But AFAIK this is a bug with the way BYOND talks to the DLL.

Expected Results:
I expected the calls to finish within 0 ticks even if the loops were in the millions or billions.

Actual Results:
Something is causing a delay of 2 ticks in the above case. Since I'm only returning a static value I'm assuming that this is something BYOND does that I can't see.

Does the problem occur:
Every time? Or how often?
Every time.
In other games?
I have a reproducible test case.
In other user accounts?
On other computers?

When does the problem NOT occur?
The problem does not occur if the amount of loops is low enough. However, for my test case I was using a higher value as I want to compare BYOND's native functionality against the one I can provide through the use of a DLL file. This delay is skewing the results.

Is there a sudden tipping point where 2 ticks becomes 30 seconds? That seems like a big jump.

One thing I can say for sure is 2 ticks for 100K loops really isn't horrible. The loop is doing quite a bit of processing all on its own: It's pushing those strings onto the stack, making the DLL call (for all I know there could be an efficiency issue in this part we can improve on), and dealing with the return value. 2 μs per call probably isn't bad, all things considered.
To add to this, the DLL call is pretty straightforward. It caches the library load on the first run so on subsequent runs the call is just relaying the data to dlsym() (in Linux). I suspect the loop processing is really the overhead. Have you tried simple loop timing tests with trivial var operations (eg i++) in the loop?
Tom changed status to 'Deferred'