|
From: | Paolo Bonzini |
Subject: | Re: Bracket expressions with character ranges are slow |
Date: | Wed, 18 May 2011 22:40:32 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10 |
On 05/18/2011 07:44 PM, Seth David Schoen wrote:
> You are correct that these cases (unlike ranges) can be optimized.Suppose grep had a preprocessor that converted any bracket expression containing elements of different byte sizes, whether [美国a] or a range not all of whose characters are a single byte, into a parenthesized alternation like (美|国|a). Would this use more memory, constituting a space-for-time tradeoff? If not, is there some other reason not to do this?
There's no justification but laziness. :) We already optimized a large amount of character ranges---basically all that can be optimizaed except this one.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |