forked from GitHub/gf-core
Use modify instead of insert: results mildly better but not significantly
This commit is contained in:
@@ -131,12 +131,13 @@ mkConcrete debug (C.Abstract _ _ _ funs) (C.Concrete modId absModId flags params
|
|||||||
where
|
where
|
||||||
val2lin :: C.LinValue -> CodeGen (L.LinFun, Maybe C.LinType)
|
val2lin :: C.LinValue -> CodeGen (L.LinFun, Maybe C.LinType)
|
||||||
val2lin lv@(C.TableValue _ _) = do
|
val2lin lv@(C.TableValue _ _) = do
|
||||||
|
-- val2lin lv@(C.ParamConstant _) = do
|
||||||
m <- CMS.get
|
m <- CMS.get
|
||||||
case Map.lookup lv m of
|
case Map.lookup lv m of
|
||||||
Just r -> return r
|
Just r -> return r
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
r <- val2lin' lv
|
r <- val2lin' lv
|
||||||
CMS.put (Map.insert lv r m)
|
CMS.modify (Map.insert lv r)
|
||||||
return r
|
return r
|
||||||
val2lin lv = val2lin' lv
|
val2lin lv = val2lin' lv
|
||||||
|
|
||||||
|
|||||||
@@ -196,6 +196,15 @@ Max memory: 2.25 GB
|
|||||||
| PhrasebookFin | 135268 | 333 | 0.2% |
|
| PhrasebookFin | 135268 | 333 | 0.2% |
|
||||||
| PhrasebookFre | 337102 | 76 | 0.02% |
|
| PhrasebookFre | 337102 | 76 | 0.02% |
|
||||||
|
|
||||||
|
_modify instead of insert_
|
||||||
|
|
||||||
|
| Concr | Total | Misses | Perc |
|
||||||
|
|:--------------|-------:|-------:|------:|
|
||||||
|
| PhrasebookEng | 3211 | 70 | 2% |
|
||||||
|
| PhrasebookSwe | 7526 | 61 | 1% |
|
||||||
|
| PhrasebookFin | 135268 | 302 | 0.2% |
|
||||||
|
| PhrasebookFre | 337102 | 72 | 0.02% |
|
||||||
|
|
||||||
**Tables**
|
**Tables**
|
||||||
|
|
||||||
| Concr | Total | Misses | Perc |
|
| Concr | Total | Misses | Perc |
|
||||||
@@ -205,9 +214,18 @@ Max memory: 2.25 GB
|
|||||||
| PhrasebookFin | 36875 | 21730 | 59% |
|
| PhrasebookFin | 36875 | 21730 | 59% |
|
||||||
| PhrasebookFre | 41397 | 32967 | 80% |
|
| PhrasebookFre | 41397 | 32967 | 80% |
|
||||||
|
|
||||||
|
_modify instead of insert_
|
||||||
|
|
||||||
|
| Concr | Total | Misses | Perc |
|
||||||
|
|:--------------|------:|-------:|-----:|
|
||||||
|
| PhrasebookEng | 2415 | 1646 | 68% |
|
||||||
|
| PhrasebookSwe | 3228 | 2188 | 68% |
|
||||||
|
| PhrasebookFin | 8793 | 4556 | 52% |
|
||||||
|
| PhrasebookFre | 12490 | 5793 | 46% |
|
||||||
|
|
||||||
Conclusions:
|
Conclusions:
|
||||||
- map itself requires more memory than acual compilation
|
- map itself requires more memory than acual compilation
|
||||||
- lookup is also as also as actual compilation
|
- lookup is also as slow as actual compilation
|
||||||
|
|
||||||
Tried HashMap (deriving Hashable for LinValue), no inprovement.
|
Tried HashMap (deriving Hashable for LinValue), no inprovement.
|
||||||
Using show on LinValue for keys is incredibly slow.
|
Using show on LinValue for keys is incredibly slow.
|
||||||
|
|||||||
Reference in New Issue
Block a user