Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf:LambdaUtils优化 #3517

Closed
wants to merge 1 commit into from
Closed

perf:LambdaUtils优化 #3517

wants to merge 1 commit into from

Conversation

dingqianwen
Copy link
Member

该Pull Request关联的Issue

无,单纯性能优化

修改描述

com.baomidou.mybatisplus.core.toolkit.LambdaUtils#resolve类修改,原来通过序列化方式获取方法引用的方法名称,性能上可以进行优化,通过jdk lambda提供的writeReplace方法,我们可以直接通过SFunction.class.getDeclaredMethod("writeReplace")获取SerializedLambda。

请参考如下图:
image

测试用例

全部通过。
com.baomidou.mybatisplus.test.toolkit.LambdaUtilsTest#simpleTest

    /**
     * 测试
     * <p>
     * print:
     * >>>
     * getId
     * getName
     * getId
     * class com.baomidou.mybatisplus.test.toolkit.LambdaUtilsTest$TestModel
     * >>>
     */
    @Test
    void simpleTest() {
        // getImplMethodName
        System.out.println(LambdaUtils.resolve(TestModel::getId).getImplMethodName());
        System.out.println(LambdaUtils.resolve(TestModel::getName).getImplMethodName());
        System.out.println(LambdaUtils.resolve(TestModel::getId).getImplMethodName());
        // getInstantiatedType
        SerializedLambda resolve = LambdaUtils.resolve(TestModel::getId);
        System.out.println(LambdaUtils.getInstantiatedType(resolve));
        // 执行原有测试用例
        this.testResolve();
        this.test();
    }

修复效果的截屏

image

去除了 com.baomidou.mybatisplus.core.toolkit.support.SerializedLambda class

@hcl04
Copy link
Contributor

hcl04 commented May 14, 2021

非常感谢,我们已经开始处理这个问题

qmdx pushed a commit that referenced this pull request May 14, 2021
@qmdx
Copy link
Member

qmdx commented May 18, 2021

已经手动合并解决,请关注 3.4.3 发布

@qmdx qmdx closed this May 18, 2021
@dingqianwen
Copy link
Member Author

已经手动合并解决,请关注3.4.3发布
非常感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants