Hi all, I need to call action from ,NET library in loop and found total time for whole operation is too long.After quick troubleshooting I noticed that any call to any dummy method in .NET running very slow:(finally testing on trivial method, just returning a the static string)10 calls: ~3sec100 calls: ~30 secOriginally library was on .NET8, then I changed it to .NET 10. Result is same.What could be a reason of such slowness?Thank you in advance
I just found in documentation: > Latency: Since an HTTPS call is made each time a server action in an external library is called, a small amount of latency is introduced in the execution time. Minimizing the number of calls to external libraries and batching operations where possible can help mitigate the impact of this latency.Oh... 0.3 sec per call is not a small latency at all. is there any way to develop a real library, on any language, which will work inside ODC app like it was in OS11?
Hello @Stanislav Ploschansky
I don't think there is a workaround for this, as it is a platform architecture decision.
I think the best you can do here is to move the looping to your external code, passing the list to it instead of calling the external code for every iteration.
Cheers!
The most likely cause isn’t .NET itself, but the way ODC is invoking your .NET library on each call.
In OutSystems Developer Cloud, every call from an action to a custom .NET library crosses a process boundary (OutSystems runtime → your library). If you call that library in a tight loop (100 times, 1000 times, …), you’re paying the overhead of:
Even if the method is trivial (returns a static string), that call overhead doesn’t disappear, so the per‑call cost dominates and you see the near‑linear scaling:
That pattern strongly suggests it’s not “slow .NET code”, but “expensive integration boundary”.
Batch work in the .NET library instead of looping in OutSystems
Instead of:
For each item: Call MyDotNetLib.DummyMethod(Item)
Refactor to:
That turns 100 slow calls into 1 call, where the overhead is paid only once.
Minimize data passed on each call
If you must call the library multiple times:
Check for extra overhead in your implementation
Inside your .NET method, confirm there’s no hidden cost per call, such as:
Move those to some sort of static / cached initialization if possible.
Consider OutSystems native alternatives
For things OutSystems can handle natively (string manipulation, math, simple data shaping, HTTP calls, etc.), it’s usually faster and simpler to implement directly in ODC actions than jumping into a custom .NET library, especially in loops.
Measure per‑call cost
Add timing inside the .NET method:
var start = DateTime.UtcNow; // trivial work var end = DateTime.UtcNow;
Compare:
If the library time is negligible and the OutSystems side is slow, that confirms the overhead is at the integration boundary, not in your .NET logic.
In summary: the slowness is almost certainly due to calling the .NET library many times from OutSystems, not the .NET runtime or your trivial method. Redesign to do more work per call (batching) and keep calls few and coarse‑grained; that’s the main way to bring total time down in ODC when using custom .NET libraries.