Code Monkey home page Code Monkey logo

Comments (9)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 23, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 23, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 23, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 23, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 23, 2024
[deleted comment]

from markdownsharp.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 23, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 23, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 23, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 23, 2024

Original comment by [email protected] on 28 Dec 2009 at 6:39

  • Changed state: Fixed

from markdownsharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.