[ 
https://issues.apache.org/jira/browse/TEXT-212?focusedWorklogId=634862&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-634862
 ]

ASF GitHub Bot logged work on TEXT-212:
---------------------------------------

                Author: ASF GitHub Bot
            Created on: 05/Aug/21 23:34
            Start Date: 05/Aug/21 23:34
    Worklog Time Spent: 10m 
      Work Description: kinow commented on a change in pull request #233:
URL: https://github.com/apache/commons-text/pull/233#discussion_r683849914



##########
File path: 
src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java
##########
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.text.jmh;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.text.similarity.LongestCommonSubsequence;
+import org.apache.commons.text.similarity.SimilarityScore;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Level;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Warmup;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Performance analysis for LongestCommonSubsequence
+ */
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.MILLISECONDS)
+@Warmup(iterations = 5, time = 1)
+@Measurement(iterations = 5, time = 1)
+@Fork(value = 1, jvmArgs = {"-server", "-Xms512M", "-Xmx512M"})
+public class LongestCommonSubsequencePerformance {
+    @State(Scope.Benchmark)
+    public static class InputData {
+        final List<Pair<CharSequence, CharSequence>> inputs = new 
ArrayList<>();
+
+        @Setup(Level.Trial)
+        public void setup() {
+            final ClassLoader classloader = 
Thread.currentThread().getContextClassLoader();
+            try (InputStream is = 
classloader.getResourceAsStream("lcs-perf-analysis-inputs.csv");
+                 InputStreamReader isr = new 
InputStreamReader(Objects.requireNonNull(is));
+                 BufferedReader br = new BufferedReader(isr)) {
+                String line;
+                while ((line = br.readLine()) != null && 
!line.trim().isEmpty()) {
+                    line = line.trim();

Review comment:
       Checkstyle was complaining about re-assigning `line` in the `while` 
block, so I left the double `line.trim` call, which shouldn't really interfere 
with the performance tests :+1: 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 634862)
    Time Spent: 0.5h  (was: 20m)

> A More Efficient Implementation for Calculating Size of Longest Common 
> Subsequence
> ----------------------------------------------------------------------------------
>
>                 Key: TEXT-212
>                 URL: https://issues.apache.org/jira/browse/TEXT-212
>             Project: Commons Text
>          Issue Type: Improvement
>    Affects Versions: 1.9
>            Reporter: Bruno P. Kinoshita
>            Assignee: Bruno P. Kinoshita
>            Priority: Major
>             Fix For: 1.10
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Placeholder for [https://github.com/apache/commons-text/pull/233]
> Paper linked and now in Javadoc comments: 
> https://www.ics.uci.edu/~eppstein/161/960229.html



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to