##// END OF EJS Templates
revset: drop optimization about reordering "or" set elements...
Jun Wu -
r34012:72b5f4d5 default
parent child Browse files
Show More
@@ -467,9 +467,6 b' def _optimize(x, small):'
467 flushss()
467 flushss()
468 if len(ts) == 1:
468 if len(ts) == 1:
469 return ws[0], ts[0] # 'or' operation is fully optimized out
469 return ws[0], ts[0] # 'or' operation is fully optimized out
470 if order != defineorder:
471 # reorder by weight only when f(a + b) == f(b + a)
472 ts = [wt[1] for wt in sorted(zip(ws, ts), key=lambda wt: wt[0])]
473 return max(ws), (op, ('list',) + tuple(ts), order)
470 return max(ws), (op, ('list',) + tuple(ts), order)
474 elif op == 'not':
471 elif op == 'not':
475 # Optimize not public() to _notpublic() because we have a fast version
472 # Optimize not public() to _notpublic() because we have a fast version
@@ -2076,19 +2076,19 b' ordering defined by it.'
2076 define)
2076 define)
2077 (or
2077 (or
2078 (list
2078 (list
2079 ('symbol', '2')
2080 (range
2079 (range
2081 ('symbol', '0')
2080 ('symbol', '0')
2082 ('symbol', '1')
2081 ('symbol', '1')
2083 follow))
2082 follow)
2083 ('symbol', '2'))
2084 follow)
2084 follow)
2085 define)
2085 define)
2086 * set:
2086 * set:
2087 <filteredset
2087 <filteredset
2088 <spanset- 0:3>,
2088 <spanset- 0:3>,
2089 <addset
2089 <addset
2090 <baseset [2]>,
2090 <spanset+ 0:2>,
2091 <spanset+ 0:2>>>
2091 <baseset [2]>>>
2092 2
2092 2
2093 1
2093 1
2094 0
2094 0
@@ -2569,69 +2569,6 b' ordering defined by it.'
2569 1
2569 1
2570 0
2570 0
2571
2571
2572 'A + B' can be rewritten to 'B + A' by weight only when the order doesn't
2573 matter (e.g. 'X & (A + B)' can be 'X & (B + A)', but '(A + B) & X' can't):
2574
2575 $ try -p optimized '0:2 & (reverse(contains("a")) + 2)'
2576 * optimized:
2577 (and
2578 (range
2579 ('symbol', '0')
2580 ('symbol', '2')
2581 define)
2582 (or
2583 (list
2584 ('symbol', '2')
2585 (func
2586 ('symbol', 'reverse')
2587 (func
2588 ('symbol', 'contains')
2589 ('string', 'a')
2590 define)
2591 follow))
2592 follow)
2593 define)
2594 * set:
2595 <filteredset
2596 <spanset+ 0:3>,
2597 <addset
2598 <baseset [2]>,
2599 <filteredset
2600 <fullreposet+ 0:10>,
2601 <contains 'a'>>>>
2602 0
2603 1
2604 2
2605
2606 $ try -p optimized '(reverse(contains("a")) + 2) & 0:2'
2607 * optimized:
2608 (and
2609 (range
2610 ('symbol', '0')
2611 ('symbol', '2')
2612 follow)
2613 (or
2614 (list
2615 (func
2616 ('symbol', 'reverse')
2617 (func
2618 ('symbol', 'contains')
2619 ('string', 'a')
2620 define)
2621 define)
2622 ('symbol', '2'))
2623 define)
2624 define)
2625 * set:
2626 <addset
2627 <filteredset
2628 <spanset- 0:3>,
2629 <contains 'a'>>,
2630 <baseset [2]>>
2631 1
2632 0
2633 2
2634
2635 test sort revset
2572 test sort revset
2636 --------------------------------------------
2573 --------------------------------------------
2637
2574
General Comments 0
You need to be logged in to leave comments. Login now