Comments (9)
As you noticed, it's a bad idea to blindly compile all the regexes.
I already made a pass with ANTS Performance profiler and compiled just the
regexes
that the profiler told me were expensive. This provides the best blend of short
and
long performance with almost no compromises.
That's the proper solution IMO -- just compile the ones that actually take the
longest. If you compile them all, short performance suffers too much. And short
performance is important; for example, the average Stack Overflow post size is
just
over 1000 characters.
Original comment by [email protected]
on 26 Dec 2009 at 9:30
- Changed state: WontFix
from markdownsharp.
Seems odd it would just be short strings. Let me test tonight and see if the
Regex compile is sililiar to the
asp.net load time where it only occurs on first hit. Seems like a logical jump
since it is first hit in the tests.
Unless you have tried this before.
Original comment by nberardi
on 26 Dec 2009 at 10:21
from markdownsharp.
well, you could increase the # of short benchmark iterations to something like
20k or
50k -- that would simulate lots of calls with initial compilation. Though, I
suspect
the results will be similar. The time taken does go down about 0.10 ms per call
when
I increase the short benchmark run size from 1k to 20k --
{{{
input string length: 475
performed 20000 iterations in 17125 (0.85625 ms per iteration)
input string length: 2356
performed 500 iterations in 1978 (3.956 ms per iteration)
input string length: 27737
performed 100 iterations in 5171 (51.71 ms per iteration)
}}}
Original comment by [email protected]
on 28 Dec 2009 at 12:22
from markdownsharp.
some comparisons of short performance, varying # of iterations...
{{{
input string length: 475
performed 1000 iterations in 977 (0.977 ms per iteration)
input string length: 475
performed 2000 iterations in 1886 (0.943 ms per iteration)
input string length: 475
performed 4000 iterations in 3578 (0.895 ms per iteration)
input string length: 475
performed 8000 iterations in 7058 (0.882 ms per iteration)
input string length: 475
performed 16000 iterations in 13899 (0.869 ms per iteration)
input string length: 475
performed 32000 iterations in 27995 (0.875 ms per iteration)
}}}
Original comment by [email protected]
on 28 Dec 2009 at 12:28
from markdownsharp.
[deleted comment]
from markdownsharp.
I updated from the latest SVN changes and here are the numbers I am seeing on
my
machine now with the following patch:
patched:
{{{
input string length: 475
performed 1000 iterations in 1047 (1.047 ms per iteration)
input string length: 2356
performed 500 iterations in 2325 (4.65 ms per iteration)
input string length: 27737
performed 100 iterations in 6583 (65.83 ms per iteration)
}}}
un-patched:
{{{
input string length: 475
performed 1000 iterations in 1202 (1.202 ms per iteration)
input string length: 2356
performed 500 iterations in 2733 (5.466 ms per iteration)
input string length: 27737
performed 100 iterations in 7411 (74.11 ms per iteration)
}}}
Seems to be getting better performance numbers with the re-factored testing
framework
that you included.
Original comment by nberardi
on 28 Dec 2009 at 3:50
Attachments:
from markdownsharp.
agreed, I can verify it's faster for me too now!
Must have something to do with the bugfixes in the previous revisions.. I'll
accept
this change since it is faster in all 3 benchmark test cases now.
Original comment by [email protected]
on 28 Dec 2009 at 6:03
- Changed state: Accepted
from markdownsharp.
oh and here are my before and after benchmarks, too:
before:
input string length: 475
performed 1000 iterations in 847 (0.847 ms per iteration)
input string length: 2356
performed 500 iterations in 1956 (3.912 ms per iteration)
input string length: 27737
performed 100 iterations in 5184 (51.84 ms per iteration)
after:
input string length: 475
performed 1000 iterations in 682 (0.682 ms per iteration)
input string length: 2356
performed 500 iterations in 1617 (3.234 ms per iteration)
input string length: 27737
performed 100 iterations in 4428 (44.28 ms per iteration)
Original comment by [email protected]
on 28 Dec 2009 at 6:04
from markdownsharp.
Original comment by [email protected]
on 28 Dec 2009 at 6:39
- Changed state: Fixed
from markdownsharp.
Related Issues (20)
- title element not escaped
- Problem with auto email links
- Add link to Pagedown on the project home page. HOT 1
- Allow to set base url for relative url
- URL detection bug for URLs that contain parentheses
- f3973492a27c breaks ConfigTest.TestEncodeProblemUrlCharacters
- Enable EmailEncoding as an option HOT 1
- <code> tags are rendered inside of <pre> for code blocks
- Add option to avoid Paragraph around single element
- Support Pandoc Extensions to Markdown
- Add Strikethrough
- Have the option to add a prettify class name to the <pre> tags
- URL: Support protcol-relative URLs
- Auto-URLs are breaking with any url that has an underscore HOT 1
- Strange <p> tag placement
- Unit test error: MarkdownSharpTests.ConfigTest.TestEncodeProblemUrlCharacters HOT 1
- AutoNewlines set through MarkdownOptions replaces EOL with <br instead of <br />
- Add SkipCodeBlocks Option HOT 1
- Migrate to GitHub! HOT 1
- Sponsor an official nuget package
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from markdownsharp.