Commit 27c08f8f authored by Nicolas Pouillard's avatar Nicolas Pouillard

getTableNgrams more timing infos

parent 35d2b25a
...@@ -115,7 +115,7 @@ import qualified Data.HashMap.Strict.InsOrd as InsOrdHashMap ...@@ -115,7 +115,7 @@ import qualified Data.HashMap.Strict.InsOrd as InsOrdHashMap
import Data.Swagger hiding (version, patch) import Data.Swagger hiding (version, patch)
import Data.Text (Text, isInfixOf, count) import Data.Text (Text, isInfixOf, count)
import Data.Validity import Data.Validity
import Formatting (hprint, (%)) import Formatting (hprint, int, (%))
import Formatting.Clock (timeSpecs) import Formatting.Clock (timeSpecs)
import GHC.Generics (Generic) import GHC.Generics (Generic)
import Gargantext.Core.Utils.Prefix (unPrefix, unPrefixSwagger) import Gargantext.Core.Utils.Prefix (unPrefix, unPrefixSwagger)
...@@ -997,15 +997,20 @@ getTableNgrams _nType nId tabType listId limit_ offset ...@@ -997,15 +997,20 @@ getTableNgrams _nType nId tabType listId limit_ offset
setScores False table = pure table setScores False table = pure table
setScores True table = do setScores True table = do
let ngrams_terms = (table ^.. each . ne_ngrams) let ngrams_terms = (table ^.. each . ne_ngrams)
t1 <- getTime'
occurrences <- getOccByNgramsOnlyFast nId occurrences <- getOccByNgramsOnlyFast nId
ngramsType ngramsType
ngrams_terms ngrams_terms
t2 <- getTime'
liftIO $ hprint stderr
("getTableNgrams/setScores #ngrams=" % int % " time=" % timeSpecs % "\n")
(length ngrams_terms) t1 t2
{- {-
occurrences <- getOccByNgramsOnlySlow nType nId occurrences <- getOccByNgramsOnlySlow nType nId
(lIds <> [listId]) (lIds <> [listId])
ngramsType ngramsType
ngrams_terms ngrams_terms
-} -}
let let
setOcc ne = ne & ne_occurrences .~ sumOf (at (ne ^. ne_ngrams) . _Just) occurrences setOcc ne = ne & ne_occurrences .~ sumOf (at (ne ^. ne_ngrams) . _Just) occurrences
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment