mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e2673de3b |
@@ -131,12 +131,13 @@ mkConcrete debug (C.Abstract _ _ _ funs) (C.Concrete modId absModId flags params
|
||||
where
|
||||
val2lin :: C.LinValue -> CodeGen (L.LinFun, Maybe C.LinType)
|
||||
val2lin lv@(C.TableValue _ _) = do
|
||||
-- val2lin lv@(C.ParamConstant _) = do
|
||||
m <- CMS.get
|
||||
case Map.lookup lv m of
|
||||
Just r -> return r
|
||||
Nothing -> do
|
||||
r <- val2lin' lv
|
||||
CMS.put (Map.insert lv r m)
|
||||
CMS.modify (Map.insert lv r)
|
||||
return r
|
||||
val2lin lv = val2lin' lv
|
||||
|
||||
|
||||
@@ -196,6 +196,15 @@ Max memory: 2.25 GB
|
||||
| PhrasebookFin | 135268 | 333 | 0.2% |
|
||||
| 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**
|
||||
|
||||
| Concr | Total | Misses | Perc |
|
||||
@@ -205,9 +214,18 @@ Max memory: 2.25 GB
|
||||
| PhrasebookFin | 36875 | 21730 | 59% |
|
||||
| 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:
|
||||
- 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.
|
||||
Using show on LinValue for keys is incredibly slow.
|
||||
|
||||
Reference in New Issue
Block a user