Mercurial > hg
comparison tests/test-revset.t @ 20499:2efd608473fb
revset: optimize missing ancestor expressions
A missing ancestor expression is any expression of the form (::x - ::y) or
equivalent. Such expressions are remarkably common, and so far have involved
multiple walks down the DAG, followed by a set difference operation.
With this patch, such expressions will be transformed into uses of the fast
algorithm at ancestor.missingancestor.
For a repository with over 600,000 revisions, perfrevset for '::tip - ::-10000'
returns:
Before: ! wall 3.999575 comb 4.000000 user 3.910000 sys 0.090000 (best of 3)
After: ! wall 0.132423 comb 0.130000 user 0.130000 sys 0.000000 (best of 75)
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Thu, 13 Feb 2014 14:04:47 -0800 |
parents | b0638b5b004d |
children | 10433163bf57 |
comparison
equal
deleted
inserted
replaced
20498:fb2df4506c87 | 20499:2efd608473fb |
---|---|
441 6 | 441 6 |
442 $ log 'tag(1.0)' | 442 $ log 'tag(1.0)' |
443 6 | 443 6 |
444 $ log 'tag(tip)' | 444 $ log 'tag(tip)' |
445 9 | 445 9 |
446 | |
447 check that conversion to _missingancestors works | |
448 $ try --optimize '::3 - ::1' | |
449 (minus | |
450 (dagrangepre | |
451 ('symbol', '3')) | |
452 (dagrangepre | |
453 ('symbol', '1'))) | |
454 * optimized: | |
455 (func | |
456 ('symbol', '_missingancestors') | |
457 (list | |
458 ('symbol', '3') | |
459 ('symbol', '1'))) | |
460 3 | |
461 $ try --optimize 'ancestors(1) - ancestors(3)' | |
462 (minus | |
463 (func | |
464 ('symbol', 'ancestors') | |
465 ('symbol', '1')) | |
466 (func | |
467 ('symbol', 'ancestors') | |
468 ('symbol', '3'))) | |
469 * optimized: | |
470 (func | |
471 ('symbol', '_missingancestors') | |
472 (list | |
473 ('symbol', '1') | |
474 ('symbol', '3'))) | |
475 $ try --optimize 'not ::2 and ::6' | |
476 (and | |
477 (not | |
478 (dagrangepre | |
479 ('symbol', '2'))) | |
480 (dagrangepre | |
481 ('symbol', '6'))) | |
482 * optimized: | |
483 (func | |
484 ('symbol', '_missingancestors') | |
485 (list | |
486 ('symbol', '6') | |
487 ('symbol', '2'))) | |
488 3 | |
489 4 | |
490 5 | |
491 6 | |
492 $ try --optimize 'ancestors(6) and not ancestors(4)' | |
493 (and | |
494 (func | |
495 ('symbol', 'ancestors') | |
496 ('symbol', '6')) | |
497 (not | |
498 (func | |
499 ('symbol', 'ancestors') | |
500 ('symbol', '4')))) | |
501 * optimized: | |
502 (func | |
503 ('symbol', '_missingancestors') | |
504 (list | |
505 ('symbol', '6') | |
506 ('symbol', '4'))) | |
507 3 | |
508 5 | |
509 6 | |
446 | 510 |
447 we can use patterns when searching for tags | 511 we can use patterns when searching for tags |
448 | 512 |
449 $ log 'tag("1..*")' | 513 $ log 'tag("1..*")' |
450 abort: tag '1..*' does not exist | 514 abort: tag '1..*' does not exist |