This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH [mainline] speed up comparing enums declared in multiple translation units



On Mar 9, 2004, at 12:40, Fariborz Jahanian wrote:



On Mar 9, 2004, at 12:27 PM, Andrew Pinski wrote:

Why are you getting rid of the code which I put in there to speed it up in the first place?
"Speed up the case where the type values are in the same order".

What code? I am working off the tree-ssa branch. This patch works regardless of any
assumption of type values.

This part:
! /* Speed up the case where the type values are in the same order. */
! tree tv1 = TYPE_VALUES (t1);
! tree tv2 = TYPE_VALUES (t2);
!
! if (tv1 == tv2)
! return 1;
!
! for (;tv1 && tv2; tv1 = TREE_CHAIN (tv2), tv2 = TREE_CHAIN (tv2))
! {
! if (TREE_PURPOSE (tv1) != TREE_PURPOSE (tv2))
! break;
! if (simple_cst_equal (TREE_VALUE (tv1), TREE_VALUE (tv2)) != 1)
! return 0;
! }
!
! if (tv1 == NULL_TREE && tv2 == NULL_TREE)
! return 1;
! if (tv1 == NULL_TREE || tv2 == NULL_TREE)
! return 0;



The whole point of this patch was to change the algorithm to be O(n) instead of O(n*m).
Since the common case is still that the type values are in the same order for both
translational units this really should be kept. Also it does not have transverse the
second linked list twice.


All mallocs are freed, after the structs in which enums are used are themselves compared. I don't
see n is being that large.

Yes you free them after comparing them but that just takes more as you still need to do the
above enum comparision for each enum more than once.



Try it right now without your patch and see how fast it is, it should not take more than an
hour as it takes on my machine.


Thanks,
Andrew Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]