Giter Site home page Giter Site logo

Comments (5)

DQinYuan avatar DQinYuan commented on July 22, 2024

看着不太可能,有计时代码吗?

from qlexpress.

bestpayAmes avatar bestpayAmes commented on July 22, 2024

看着不太可能,有计时代码吗?

ExpressRunner expressRunner = new ExpressRunner(true,false);
long begin=System.currentTimeMillis();
try{
Map map=new HashMap();
map.put("status","N");
DefaultContext<String, Object> context = new DefaultContext<String, Object>();
context.putAll(map);
Object o = expressRunner.execute("status%9", context, null, true, false);
System.out.println(o);
}catch (Exception e){
//throw e;
}finally {
System.out.println(System.currentTimeMillis()-begin);
}
有的

from qlexpress.

DQinYuan avatar DQinYuan commented on July 22, 2024
public class PerformanceTest {

    @Test
    public void perfTest() throws Exception {
        ExpressRunner expressRunner = new ExpressRunner(true,false);
        long begin=System.currentTimeMillis();
        try{
            Map map=new HashMap();
            map.put("status",10);
            DefaultContext<String, Object> context = new DefaultContext<String, Object>();
            context.putAll(map);
            Object o = expressRunner.execute("status%9", context, null, true, false);
            System.out.println(o);
        } finally {
            System.out.println(System.currentTimeMillis()-begin);
        }
    }
}

@bestpayAmes 我在自己机器上用单元测试测的, 7 ms, 如果有缓存, 肯定是在 1ms 以内
你那个 15s 的是不是在线上机器跑的, CPU 吃紧, 线程调度花了很多时间.
ExpressRunner 在线上一定要用成单例

from qlexpress.

bestpayAmes avatar bestpayAmes commented on July 22, 2024
            map.put("status",10);
        map.put("status","N");改成非数字就能复现;出现异常的情况第一次运行就会很慢;

from qlexpress.

DQinYuan avatar DQinYuan commented on July 22, 2024

@bestpayAmes 依旧是 9ms

image

from qlexpress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.