I’ve done some testing to see if transformers are slower than invoke.
The service I constructed looks something like this:
-
Create a string list via a Java service. The service takes a count as input and outputs a list of strings with entry 0 intialized to “0”, entry 1 initialized to “1”, etc.
-
Snapshot the current time. I have a wrapper service for java.util.Date.getTimeMillis().
-
Loop over the list created in step 1.
-
Within the loop, use a transformer to call pub.string:concat. inString1 is set to “string” and inString2 is mapped from $iteration. value is mapped to outString.
-
Snapshot the current time.
-
Compute the difference of current time from start time and place in transformerElapsed.
-
Drop interim variables to start with clean pipeline. Keep original list.
-
Snapshot the current time.
-
Loop over the list created in step 1.
-
Within the loop, invoke pub.string:concat. inString1 is set to “string” and inString2 is mapped from $iteration. value is mapped to outString.
-
Snapshot the current time.
-
Compute the difference of current time from start time and place in invokeElapsed.
This service was run ten times for each source list sizes of 10, 100, 1000, and 10000.
List size (# of loops) Avg diff per list entry
10 6.12 (milliseconds)
100 4.679
1000 0.5611
10000 0.20421
Avg diff per entry in millis is the average difference in milliseconds for each entry in the list, with invoke consistently performing faster. The difference between invoke vs. transformer for processing all 10000 entries averaged 2 seconds.
IMO, this difference isn’t significant, even for a small loop. I can share my service and results with anyone that would like to take a look. I may be doing something within the service that skews the results, so another set of eyes is welcome.
B2B Server: 4.0.1
Build Number: 697
Java Version: 1.3.0 (46.0)
Java Vendor: IBM Corporation
OS: Windows NT 4.0 SP5
Dell Optiplex GX110, P3, 733, 512MB
B2B Integrator and Server run on same machine.
#Integration-Server-and-ESB#webMethods-General#webMethods