logo separator

[mkgmap-dev] [mkgmap-svn] Commit: r1488: RuleFileReader.optimiseAndSaveBinaryOp(): Try to be symmetric.

From Steve Ratcliffe steve at parabola.me.uk on Mon Jan 18 09:10:49 GMT 2010

On 18/01/10 08:13, svn commit wrote:
> RuleFileReader.optimiseAndSaveBinaryOp(): Try to be symmetric.
> optimiseAndSaveAndOr(): Refactored from optimiseAndSaveBinaryOp().

So you are trying to transform

  a=b & (c=d|e=f)

to

  a=b&c=d | a=b&e=f

The second.isType(OR) will not be executed because first.isType(EQUALS)
will have matched first.

Also it is not so clear that it is an optimisation as both the new rules 
will be under the same search key and so you will end up doing pretty 
much the same thing in either case. With the OR first they will be under 
different search keys and so will reduce the work in some cases.

But more importantly it is *necessary* to deal with the case where the 
OR comes first because the first term has to be an EQUALS or EXISTS. 
Symmetry does not apply as the situation is asymmetrical to begin with, 
and there is no such requirement on the second term.

..Steve



More information about the mkgmap-dev mailing list