Show
Ignore:
Timestamp:
04/28/06 17:47:48 (3 years ago)
Author:
audreyt
Message:

* Pugs.Types.findList dominates a typical profile;

attempt to fix it by memoizing the original result using
initCache, and change the representation to a "Buf"
(i.e. Data.ByteString?.ByteString?.)

* Update all our tools to deal with ByteStrings?.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Prim/Match.hs

    r10059 r10113  
    7979not_VRule _            = True 
    8080 
     81classType :: Type 
     82classType = mkType "Class" 
     83 
    8184-- XXX - need to generalise this 
    8285op2Match :: Val -> Val -> Eval Val 
     
    100103    op2Match x y' 
    101104 
    102 op2Match x@(VObject MkObject{ objType = MkType "Class" } ) y = do 
     105op2Match x@(VObject MkObject{ objType = cls }) y | cls == classType = do 
    103106    fetch   <- doHash x hash_fetchVal 
    104107    name    <- fromVal =<< fetch "name" 
    105     op2Match (VType (MkType name)) y 
    106  
    107 op2Match x y@(VObject MkObject{ objType = MkType "Class" } ) = do 
     108    op2Match (VType (mkType name)) y 
     109 
     110op2Match x y@(VObject MkObject{ objType = cls }) | cls == classType = do 
    108111    fetch   <- doHash y hash_fetchVal 
    109112    name    <- fromVal =<< fetch "name" 
    110     op2Match x (VType (MkType name)) 
     113    op2Match x (VType (mkType name)) 
    111114 
    112115op2Match x (VSubst (rx, subst)) | rxGlobal rx = do 
     
    202205    typ <- fromVal x 
    203206    case x of 
    204         VRef x | typ == MkType "Class" -> do 
     207        VRef x | typ == mkType "Class" -> do 
    205208            x' <- readRef x 
    206209            op2Match x' y