@@ -0,0 +1,2847 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.apache.commons.codec.language.bm;%0A%0Aimport org.junit.Test;%0A%0Apublic class CacheSubSequencePerformanceTest %7B%0A%0A    @Test%0A    public void test() %7B%0A        final int times = 10000000;%0A        System.out.print(%22Test with String : %22);%0A        test(%22Angelo%22, times);%0A        System.out.print(%22Test with StringBuilder : %22);%0A        test(new StringBuilder(%22Angelo%22), times);%0A        System.out.print(%22Test with cached String : %22);%0A        test(cacheSubSequence(%22Angelo%22), times);%0A        System.out.print(%22Test with cached StringBuilder : %22);%0A        test(cacheSubSequence(new StringBuilder(%22Angelo%22)), times);%0A    %7D%0A%0A    private void test(final CharSequence input, final int times) %7B%0A        final long beginTime = System.currentTimeMillis();%0A        for (int i = 0; i %3C times; i++) %7B%0A            test(input);%0A        %7D%0A        System.out.println(System.currentTimeMillis() - beginTime + %22 millis%22);%0A    %7D%0A%0A    private void test(final CharSequence input) %7B%0A        for (int i = 0; i %3C input.length(); i++) %7B%0A            for (int j = i; j %3C= input.length(); j++) %7B%0A                input.subSequence(i, j);%0A            %7D%0A        %7D%0A    %7D%0A%0A    private CharSequence cacheSubSequence(final CharSequence cached) %7B%0A        final CharSequence%5B%5D%5B%5D cache = new CharSequence%5Bcached.length()%5D%5Bcached.length()%5D;%0A        return new CharSequence() %7B%0A            @Override%0A            public char charAt(final int index) %7B%0A                return cached.charAt(index);%0A            %7D%0A%0A            @Override%0A            public int length() %7B%0A                return cached.length();%0A            %7D%0A%0A            @Override%0A            public CharSequence subSequence(final int start, final int end) %7B%0A                if (start == end) %7B%0A                    return %22%22;%0A                %7D%0A                CharSequence res = cache%5Bstart%5D%5Bend - 1%5D;%0A                if (res == null) %7B%0A                    res = cached.subSequence(start, end);%0A                    cache%5Bstart%5D%5Bend - 1%5D = res;%0A                %7D%0A                return res;%0A            %7D%0A        %7D;%0A    %7D%0A%7D%0A

Add a performance test.