Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
UPDATE: ahh, nevermind. BrowserUk just debunked this...


Somewhat related...

For what it's worth, I used Memoize on the String::LCSS::lcss sub, and the increase in performance is huge. In fact, String::LCSS is faster than String::LCSS_XS.

The String::LCSS_XS POD shows these Benchmark results (which I was able to reproduce):

Rate String::LCSS String::LCSS_XS String::LCSS 60.9/s -- -100% String::LCSS_XS 84746/s 138966% --

Here are the results with Memoize:

String::LCSS version = 0.12 String::LCSS_XS version = 1.2 >>>the quick brown fox <<< >>>the quick brown fox <<< Rate LCSS_XS LCSS LCSS_XS 195695/s -- -27% LCSS 268817/s 37% --

Here is the code to run it:

use strict; use warnings; use Benchmark qw(cmpthese); use String::LCSS qw(); use String::LCSS_XS qw(); use Memoize qw(memoize); memoize('String::LCSS::lcss'); printf "String::LCSS version = %s\n", $String::LCSS::VERSION; printf "String::LCSS_XS version = %s\n", $String::LCSS_XS::VERSION; my $s = 'i pushed the lazy dog into a creek, the quick brown fox told +me to'; my $t = 'the quick brown fox jumps over the lazy dog'; printf ">>>%s<<<\n", String::LCSS::lcss ($s, $t); printf ">>>%s<<<\n", String::LCSS_XS::lcss($s, $t); print "\n"; #cmpthese(100_000, { # w/out memoize cmpthese(1_000_000, { # w/ memoize LCSS => sub { my $lcss = String::LCSS::lcss ($s, $t); }, LCSS_XS => sub { my $lcss = String::LCSS_XS::lcss($s, $t); }, });

Keep in mind that String::LCSS has critical bugs.


In reply to Re^2: A better implementation of LCSS? (Memoize) by toolic
in thread A better implementation of LCSS? by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-04-23 11:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found