Guava Charmatcher static initialization slow

后端 未结 4 559
一个人的身影
一个人的身影 2021-02-08 19:32

UPDATE: It looks like my 13.0.1 is calling code from this diffed CharMatcher.

http://code.google.com/p/guava-libraries/source/diff?spec=svn69ad96b719d7cd3d872a948d7454f1

4条回答
  •  名媛妹妹
    2021-02-08 19:59

    Just tested with :

    @Test
    public void testCharMatcherSlow() throws Exception {
        System.out.println(CharMatcher.JAVA_DIGIT.matches('1'));
    }
    

    and it took 0.06sec to execute. Also looked at the CharMatcher code, and nothing could explain the slow behavior you encounter. You should replace the CharMatcher by a mock to see that it is not the issue and maybe use a profiler to find out the cause.

提交回复
热议问题