干不动了伙计们,老板说每天导它个 5000 App 下载
本次发版新增了javax.script 集成
ScriptEngineManager scriptEngineManager = new ScriptEngineManager(); ScriptEngine beetlEngine = scriptEngineManager.getEngineByName("beetl"); //一个简单例子 SimpleBindings simpleBindings = new SimpleBindings(); simpleBindings.put("arg",arg); Map map = null; try { map = (Map)beetlEngine.eval("return arg.age+(arg.pay+12);",simpleBindings); return map.get("return"); } catch (ScriptException e) { System.out.println(e); }
其他调整
- 修复Native调用,空指针提示不友好的问题
- 取消内部一个性能优化类VarRefOptimal,因为它和VarRef 在出错提示上表现的不一致,性能提升有限
Maven
<dependency> <groupId>com.ibeetl</groupId> <artifactId>beetl</artifactId> <version>3.18.0.RELEASE</version> </dependency>
最新模板性能测试,各个模板引擎均采用最新版本, Score 越大越好
Beetl=Enjoy>Rocker>>Freemarker>>Thymeleaf==Velociy
Benchmark Mode Cnt Score Error Units Beetl.benchmark thrpt 5 109547.863 ± 17161.576 ops/s BeetlByte.benchmark thrpt 5 237799.769 ± 5904.514 ops/s Enjoy.benchmark thrpt 5 99695.440 ± 14083.595 ops/s EnjoyByte.benchmark thrpt 5 223874.001 ± 7265.307 ops/s Freemarker.benchmark thrpt 5 41452.634 ± 15917.119 ops/s Handlebars.benchmark thrpt 5 40360.198 ± 24345.048 ops/s Rocker.benchmark thrpt 5 63657.017 ± 4653.265 ops/s Thymeleaf.benchmark thrpt 5 6457.169 ± 272.613 ops/s Velocity.benchmark thrpt 5 8024.042 ± 2097.396 ops/s
最新脚本引擎性能测试,Score 越大越好
Liquor>>WastEl>JfireEL=Spel>> Aviator=Beetl=Jexl3 >>Mvel=Groovy>>Nashorn
Benchmark Mode Cnt Score Error Units Aviator.forExpresss thrpt 5 452423.525 ± 98409.357 ops/s Aviator.ifExpresss thrpt 5 4537367.630 ± 64633.119 ops/s Aviator.simpleExpress thrpt 5 3836403.575 ± 31114.019 ops/s Beetl.forExpresss thrpt 5 1526847.329 ± 265889.574 ops/s Beetl.ifExpresss thrpt 5 4423805.098 ± 1124023.073 ops/s Beetl.reflect thrpt 5 70820.070 ± 97197.223 ops/s Beetl.simpleExpress thrpt 5 4668751.853 ± 242267.492 ops/s Groovy.ifExpresss thrpt 5 138120.419 ± 3309.883 ops/s Groovy.simpleExpress thrpt 5 143464.468 ± 4109.476 ops/s Jexl3.forExpresss thrpt 5 778238.519 ± 37223.120 ops/s Jexl3.ifExpresss thrpt 5 4546708.051 ± 102121.733 ops/s Jexl3.simpleExpress thrpt 5 3959981.088 ± 104018.551 ops/s JfireEL.ifExpresss thrpt 5 28492758.519 ± 1255731.601 ops/s JfireEL.simpleExpress thrpt 5 20056530.964 ± 180910.226 ops/s Liquor.forExpresss thrpt 5 153428936.910 ± 1546258.435 ops/s Liquor.ifExpresss thrpt 5 164543228.416 ± 5095296.054 ops/s Liquor.simpleExpress thrpt 5 146376926.076 ± 4291072.121 ops/s Mvel.forExpresss thrpt 5 12189.900 ± 338.097 ops/s Mvel.ifExpresss thrpt 5 221874.548 ± 37709.654 ops/s Mvel.simpleExpress thrpt 5 322864.761 ± 6554.101 ops/s Spel.ifExpresss thrpt 5 18967054.667 ± 443073.976 ops/s Spel.simpleExpress thrpt 5 18319163.907 ± 627641.759 ops/s WastEl.ifExpresss thrpt 5 43778985.720 ± 502399.670 ops/s WastEl.simpleExpress thrpt 5 42311866.127 ± 2747860.496 ops/s
还没有评论,来说两句吧...