Hello, Currently whenever you want to make some processing and a JMeter function is not available for it, you can only use __BeanShell function. For example: - substring - length - Maths functions - + hundreds of examples where you need the power of Java without wanting to use a JSR223TestElement. .... Unfortunately Beanshell performances are horrid compared to Groovy ones for example besides the fact that Groovy is now integrated in JMeter, maintained by Apache and very popular and that Beanshell is nearly abandoned. So we propose to add this function that will work the same way as Beanshell.
Created attachment 34139 [details] Patch implementing this new feature
Created attachment 34140 [details] Test plan showing use case and allowing performane comparison
On my machine with a default setup: TG-Groovy Enabled only: Generate Summary Results = 20000 in 00:00:00 = 41666.7/s Avg: 0 Min: 0 Max: 2 Err: 0 (0.00%) TG-Beanshell enabled only: Generate Summary Results + 891 in 00:00:01 = 1161.7/s Avg: 0 Min: 0 Max: 1 Err: 0 (0.00%) Active: 0 Started: 20 Finished: 20 Generate Summary Results = 40000 in 00:00:16 = 2539.4/s Avg: 0 Min: 0 Max: 2 Err: 0 (0.00%) This simple benchmark shows that this new __g function is 35 times faster than __BeanShell.
(In reply to UbikLoadPack support from comment #3) > On my machine with a default setup: > > TG-Groovy Enabled only: > Generate Summary Results = 20000 in 00:00:00 = 41666.7/s Avg: 0 Min: > 0 Max: 2 Err: 0 (0.00%) > > > TG-Beanshell enabled only: > Generate Summary Results + 891 in 00:00:01 = 1161.7/s Avg: 0 Min: > 0 Max: 1 Err: 0 (0.00%) Active: 0 Started: 20 Finished: 20 > Generate Summary Results = 40000 in 00:00:16 = 2539.4/s Avg: 0 Min: > 0 Max: 2 Err: 0 (0.00%) > > > This simple benchmark shows that this new __g function is 35 times faster > than __BeanShell. Sorry little mistake for Beanshell: Generate Summary Results + 17444 in 00:00:13 = 1312.6/s Avg: 0 Min: 0 Max: 2 Err: 0 (0.00%) Active: 10 Started: 10 Finished: 0 Generate Summary Results + 2556 in 00:00:02 = 1296.1/s Avg: 0 Min: 0 Max: 1 Err: 0 (0.00%) Active: 0 Started: 10 Finished: 10 Generate Summary Results = 20000 in 00:00:15 = 1310.4/s Avg: 0 Min: 0 Max: 2 Err: 0 (0.00%) This simple benchmark shows that this new __g function is 31 times faster than __BeanShell.
This seems fine, but I think it's confusing to use the name '__g'. The function should be called '__groovy' to align with the other scripting functions. Also the new file needs the standard AL header.
Author: pmouawad Date: Fri Aug 12 11:00:39 2016 New Revision: 1756144 URL: http://svn.apache.org/viewvc?rev=1756144&view=rev Log: Bug 59991 - New function __groovy to evaluate Groovy Script Contributed by Ubik Load Pack Bugzilla Id: 59991 Added: jmeter/trunk/src/functions/org/apache/jmeter/functions/Groovy.java (with props) Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties jmeter/trunk/xdocs/changes.xml jmeter/trunk/xdocs/usermanual/functions.xml