Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Przemyslaw Kaminski
haskell-gargantext
Commits
1a2bda5e
Commit
1a2bda5e
authored
Dec 02, 2019
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getTableNgrams: display timing information
parent
032391ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
5 deletions
+25
-5
package.yaml
package.yaml
+2
-0
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+23
-5
No files found.
package.yaml
View file @
1a2bda5e
...
...
@@ -100,6 +100,7 @@ library:
-
case-insensitive
-
cassava
#- charsetdetect-ae # detect charset
-
clock
-
clustering-louvain
-
conduit
-
conduit-extra
...
...
@@ -115,6 +116,7 @@ library:
-
duckling
-
exceptions
-
filepath
-
formatting
-
fullstop
-
fclabels
-
fgl
...
...
src/Gargantext/API/Ngrams.hs
View file @
1a2bda5e
...
...
@@ -115,6 +115,8 @@ import qualified Data.HashMap.Strict.InsOrd as InsOrdHashMap
import
Data.Swagger
hiding
(
version
,
patch
)
import
Data.Text
(
Text
,
isInfixOf
,
count
)
import
Data.Validity
import
Formatting
(
hprint
,
(
%
))
import
Formatting.Clock
(
timeSpecs
)
import
GHC.Generics
(
Generic
)
import
Gargantext.Core.Utils.Prefix
(
unPrefix
,
unPrefixSwagger
)
-- import Gargantext.Database.Schema.Ngrams (NgramsTypeId, ngramsTypeId, NgramsTableData(..))
...
...
@@ -134,7 +136,9 @@ import Gargantext.Prelude
-- import Gargantext.Core.Types (ListTypeId, listTypeId)
import
Gargantext.Core.Types
(
ListType
(
..
),
NodeId
,
ListId
,
DocId
,
Limit
,
Offset
,
HasInvalidError
,
assertValid
)
import
Servant
hiding
(
Patch
)
import
System.Clock
(
getTime
,
TimeSpec
,
Clock
(
..
))
import
System.FileLock
(
FileLock
)
import
System.IO
(
stderr
)
import
Test.QuickCheck
(
elements
)
import
Test.QuickCheck.Arbitrary
(
Arbitrary
,
arbitrary
)
...
...
@@ -932,7 +936,8 @@ type MaxSize = Int
-- | Table of Ngrams is a ListNgrams formatted (sorted and/or cut).
-- TODO: should take only one ListId
getTime'
::
MonadIO
m
=>
m
TimeSpec
getTime'
=
liftIO
$
getTime
ProcessCPUTime
getTableNgrams
::
forall
env
err
m
.
...
...
@@ -947,7 +952,8 @@ getTableNgrams :: forall env err m.
getTableNgrams
_nType
nId
tabType
listId
limit_
offset
listType
minSize
maxSize
orderBy
searchQuery
=
do
_lIds
<-
selectNodesWithUsername
NodeList
userMaster
t0
<-
getTime'
-- lIds <- selectNodesWithUsername NodeList userMaster
let
ngramsType
=
ngramsTypeFromTabType
tabType
offset'
=
maybe
0
identity
offset
...
...
@@ -1012,11 +1018,23 @@ getTableNgrams _nType nId tabType listId limit_ offset
let
nSco
=
needsScores
orderBy
tableMap1
<-
getNgramsTableMap
listId
ngramsType
t1
<-
getTime'
tableMap2
<-
tableMap1
&
v_data
%%~
setScores
nSco
.
Map
.
mapWithKey
ngramsElementFromRepo
tableMap2
&
v_data
%%~
fmap
NgramsTable
.
setScores
(
not
nSco
)
.
selectAndPaginate
t2
<-
getTime'
tableMap3
<-
tableMap2
&
v_data
%%~
fmap
NgramsTable
.
setScores
(
not
nSco
)
.
selectAndPaginate
t3
<-
getTime'
liftIO
$
hprint
stderr
(
"getTableNgrams total="
%
timeSpecs
%
" map1="
%
timeSpecs
%
" map2="
%
timeSpecs
%
" map3="
%
timeSpecs
%
"
\n
"
)
t0
t3
t0
t1
t1
t2
t2
t3
pure
tableMap3
-- APIs
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment