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

Underscores around text gives performance problems - SourceForge Issue #2086757 #7

Open
myabc opened this issue Nov 18, 2013 · 2 comments

Comments

@myabc
Copy link
Owner

myabc commented Nov 18, 2013

From alex.coles on October 28, 2008 01:22:45

Underscores around text gives performance problems

I have discovered what appears to be a bug that can lead to rather severe
performance problems. The bug becomes evident when trying to "markdown"
strings similar to "_ _ _ _ _ _ text _ _ _ _ ". The easiest test case that
demonstrates this bug is the following code snippet: processor.markdown("

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ T");

After some testing, it seems like every additional "_ " BEFORE the "T" will
increase the time for "markdown" to execute doubles. When having 26 "_ "
(that is, underscore followed by space), the "markdown" takes about 100
seconds on my laptop. 25 "_ " takes around 50 seconds, and so on.

Below is the code snippet that can be used to reproduce the results.

If more details are needed, I can be contacted at Per Hallström
[email protected].

=== CODE ===
public void test2() {
String problematicPlaintext = "T";

for(int i=0;i<30;i++) {
long start = System.currentTimeMillis();
processor.markdown(problematicPlaintext);
long end = System.currentTimeMillis();
System.out.printf("i = %02d: %08d ms -- %56s\n", i,
(end-start), problematicPlaintext);
problematicPlaintext = "_ " + problematicPlaintext;
}
}

=== EXAMPLE OUTPUT ===

i = 15: 00000051 ms -- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
T
i = 16: 00000096 ms -- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
T
i = 17: 00000207 ms -- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
T
i = 18: 00000405 ms -- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
T
i = 19: 00000905 ms -- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
T
i = 20: 00001514 ms -- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
T
i = 21: 00003008 ms -- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
T
i = 22: 00006115 ms -- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
T
i = 23: 00012232 ms -- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
T
i = 24: 00024220 ms -- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
T
i = 25: 00048662 ms -- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
T

Original issue: http://code.google.com/p/markdownj/issues/detail?id=4

@ghost ghost assigned myabc Nov 18, 2013
@myabc
Copy link
Owner Author

myabc commented Nov 18, 2013

From alex.coles on October 27, 2008 18:10:13

Labels: -Priority-Medium Priority-High Milestone-Release0.4.0

@myabc
Copy link
Owner Author

myabc commented Nov 18, 2013

From alex.coles on February 17, 2013 06:32:32

Labels: -Milestone-Release0.4.0 Milestone-Release0.5.0

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

No branches or pull requests

1 participant