Skip to content

ScriptRouter should cache CompiledScript #390

Closed

Description

@likebean

看到每次route都去compilable.compile,是否应该在构造函数里compile,每次route直接用CompiledScript,这样性能应该有提升。

public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException {
    try {
        List<Invoker<T>> invokersCopy = new ArrayList<Invoker<T>>(invokers);
        Compilable compilable = (Compilable) engine;
        Bindings bindings = engine.createBindings();
        bindings.put("invokers", invokersCopy);
        bindings.put("invocation", invocation);
        bindings.put("context", RpcContext.getContext());
        CompiledScript function = compilable.compile(rule);

Activity

  1. added a commit that references this issue on Feb 21, 2019
  2. ralf0131 commented on Feb 21, 2019

    @ralf0131
    Contributor

    This issue is fixed from 2.7.1 onwards.

  3. added this to the 2.7.1 milestone on Mar 4, 2019
  4. changed the title [-]ScriptRouter中的CompiledScript应该缓存?[/-] [+]ScriptRouter should cache CompiledScript[/+] on Mar 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions