lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dawid Weiss (JIRA)" <>
Subject [jira] [Commented] (LUCENE-3094) optimize lev automata construction
Date Fri, 13 May 2011 18:53:47 GMT


Dawid Weiss commented on LUCENE-3094:

This looks good to me. And even if it doesn't affect performance it definitely should help
those poor souls wishing to actually understand this algorithm :)

> optimize lev automata construction
> ----------------------------------
>                 Key: LUCENE-3094
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Robert Muir
>             Fix For: 4.0
>         Attachments: LUCENE-3094.patch, after.png, before.png
> in our lev automata algorithm, we compute an upperbound of the maximum possible states
(not the true number), and
> create some "useless" unconnected states "floating around".
> this isn't harmful, in the original impl we did the Automaton is simply a pointer to
the initial state, and all algorithms
> traverse this list, so effectively the useless states were dropped immediately. But recently
we changed automaton to
> cache its numberedStates, and we set them here, so these useless states are being kept
> it has no impact on performance, but can be really confusing if you are debugging (e.g.
toString). Thanks to Dawid Weiss
> for noticing this. 
> at the same time, forcing an extra traversal is a bit scary, so i did some benchmarking
with really long strings and found
> that actually its helpful to reduce() the number of transitions (typically cuts them
in half) for these long strings, as it
> speeds up some later algorithms. 
> won't see any speedup for short terms, but I think its easier to work with these simpler
automata anyway, and it eliminates
> the confusion of seeing the redundant states without slowing anything down.

This message is automatically generated by JIRA.
For more information on JIRA, see:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message