Skip to content

Commit 3b7f060

Browse files
authored
Merge pull request #11 from OxfordAbstracts/nosqlite
don't save unneeeded stuff on sqlite
2 parents 64300ad + 43d52a0 commit 3b7f060

File tree

4 files changed

+36
-102
lines changed

4 files changed

+36
-102
lines changed

profile-admin.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
'purs' 'compile' '--source-globs-file' '.spago/sources.txt' +RTS '-N' '-A256m' '-n16m' '-sprofile.txt'
2-
615,026,369,264 bytes allocated in the heap
3-
62,526,339,128 bytes copied during GC
4-
4,808,133,160 bytes maximum residency (7 sample(s))
5-
30,469,184 bytes maximum slop
6-
16158 MiB total memory in use (0 MiB lost due to fragmentation)
2+
599,749,969,784 bytes allocated in the heap
3+
62,069,592,800 bytes copied during GC
4+
4,801,445,848 bytes maximum residency (7 sample(s))
5+
31,633,448 bytes maximum slop
6+
16226 MiB total memory in use (0 MiB lost due to fragmentation)
77

88
Tot time (elapsed) Avg pause Max pause
9-
Gen 0 239 colls, 239 par 59.390s 7.687s 0.0322s 0.1657s
10-
Gen 1 7 colls, 6 par 17.637s 4.178s 0.5969s 1.2704s
9+
Gen 0 232 colls, 232 par 58.775s 8.031s 0.0346s 0.1425s
10+
Gen 1 7 colls, 6 par 17.978s 4.666s 0.6666s 1.5471s
1111

12-
Parallel GC work balance: 91.91% (serial 0%, perfect 100%)
12+
Parallel GC work balance: 92.23% (serial 0%, perfect 100%)
1313

14-
TASKS: 67 (1 bound, 65 peak workers (66 total), using -N10)
14+
TASKS: 65 (1 bound, 64 peak workers (64 total), using -N10)
1515

1616
SPARKS: 7516 (7516 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)
1717

18-
INIT time 0.151s ( 0.151s elapsed)
19-
MUT time 304.986s ( 90.340s elapsed)
20-
GC time 77.027s ( 11.865s elapsed)
21-
EXIT time 0.249s ( 0.009s elapsed)
22-
Total time 382.413s (102.365s elapsed)
18+
INIT time 0.149s ( 0.149s elapsed)
19+
MUT time 298.230s ( 81.714s elapsed)
20+
GC time 76.753s ( 12.697s elapsed)
21+
EXIT time 0.261s ( 0.003s elapsed)
22+
Total time 375.393s ( 94.563s elapsed)
2323

24-
Alloc rate 2,016,569,461 bytes per MUT second
24+
Alloc rate 2,011,031,039 bytes per MUT second
2525

26-
Productivity 79.8% of total user, 88.3% of total elapsed
26+
Productivity 79.4% of total user, 86.4% of total elapsed
2727

profile.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
'purs' 'compile' '--source-globs-file' '.spago/sources.txt' +RTS '-N' '-A256m' '-n16m' '-sprofile.txt'
2-
1,239,641,572,944 bytes allocated in the heap
3-
92,117,540,648 bytes copied during GC
4-
2,525,848,440 bytes maximum residency (16 sample(s))
5-
41,515,920 bytes maximum slop
6-
9680 MiB total memory in use (0 MiB lost due to fragmentation)
2+
1,173,434,083,800 bytes allocated in the heap
3+
90,812,899,016 bytes copied during GC
4+
2,324,365,280 bytes maximum residency (16 sample(s))
5+
41,667,856 bytes maximum slop
6+
9037 MiB total memory in use (0 MiB lost due to fragmentation)
77

88
Tot time (elapsed) Avg pause Max pause
9-
Gen 0 462 colls, 462 par 98.367s 12.592s 0.0273s 0.1880s
10-
Gen 1 16 colls, 15 par 26.135s 3.701s 0.2313s 0.3772s
9+
Gen 0 438 colls, 438 par 98.124s 12.261s 0.0280s 0.1369s
10+
Gen 1 16 colls, 15 par 26.352s 3.585s 0.2240s 0.3630s
1111

12-
Parallel GC work balance: 90.30% (serial 0%, perfect 100%)
12+
Parallel GC work balance: 90.36% (serial 0%, perfect 100%)
1313

14-
TASKS: 70 (1 bound, 69 peak workers (69 total), using -N10)
14+
TASKS: 71 (1 bound, 69 peak workers (70 total), using -N10)
1515

1616
SPARKS: 7516 (7516 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)
1717

18-
INIT time 0.174s ( 0.173s elapsed)
19-
MUT time 612.239s (126.344s elapsed)
20-
GC time 124.502s ( 16.293s elapsed)
21-
EXIT time 0.107s ( 0.009s elapsed)
22-
Total time 737.021s (142.819s elapsed)
18+
INIT time 0.176s ( 0.175s elapsed)
19+
MUT time 596.810s (105.074s elapsed)
20+
GC time 124.476s ( 15.845s elapsed)
21+
EXIT time 0.096s ( 0.008s elapsed)
22+
Total time 721.557s (121.102s elapsed)
2323

24-
Alloc rate 2,024,767,533 bytes per MUT second
24+
Alloc rate 1,966,178,107 bytes per MUT second
2525

26-
Productivity 83.1% of total user, 88.5% of total elapsed
26+
Productivity 82.7% of total user, 86.8% of total elapsed
2727

src/Language/PureScript/Make/Actions.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ buildMakeActions outputDir filePathMap foreigns usePrefix =
290290
codegen ast m docs exts = do
291291
let mn = CF.moduleName m
292292
lift $ writeCborFile (outputFilename mn externsFileName) exts
293-
lift $ sqliteExtern outputDir ast docs exts
293+
lift $ sqliteExtern outputDir ast exts
294294
codegenTargets <- lift $ asks optionsCodegenTargets
295295
when (S.member CoreFn codegenTargets) $ do
296296
let coreFnFile = targetFilename mn CoreFn

src/Language/PureScript/Make/IdeCache.hs

Lines changed: 3 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@ import Language.PureScript.AST.Traversals (everywhereOnValuesM)
2828
import Protolude (identity)
2929
import Language.PureScript.Names qualified as T
3030

31-
sqliteExtern :: (MonadIO m) => FilePath -> Module -> Docs.Module -> ExternsFile -> m ()
32-
sqliteExtern outputDir m docs extern = liftIO $ do
31+
sqliteExtern :: (MonadIO m) => FilePath -> Module -> ExternsFile -> m ()
32+
sqliteExtern outputDir m extern = liftIO $ do
3333
conn <- SQLite.open db
3434
SQLite.execute_ conn "pragma busy_timeout = 300000;"
3535

36-
-- Debug.traceM $ show extern
37-
3836
let (doDecl, _, _) = everywhereOnValuesM (pure . identity) (\expr -> case expr of
3937
Var ss i -> do
4038
let iv = disqualify i
@@ -62,7 +60,7 @@ sqliteExtern outputDir m docs extern = liftIO $ do
6260
SQLite.executeNamed conn
6361
"insert into modules (module_name, comment, extern, dec) values (:module_name, :docs, :extern, :dec)"
6462
[ ":module_name" := runModuleName ( efModuleName extern )
65-
, ":docs" := Docs.modComments docs
63+
, ":docs" := Just ("" :: Text)
6664
, ":extern" := Serialise.serialise extern
6765
, ":dec" := show ( efExports extern )
6866
]
@@ -110,52 +108,6 @@ sqliteExtern outputDir m docs extern = liftIO $ do
110108
, ":declaration" := serialise ideDeclaration
111109
])
112110

113-
for_ (Docs.modDeclarations docs) (\d -> do
114-
SQLite.executeNamed conn
115-
("insert into declarations (module_name, name, namespace, declaration_type, span, type, docs, declaration) " <>
116-
"values (:module_name, :name, :namespace, :declaration_type, :span, :type, :docs, :declaration)"
117-
)
118-
[ ":module_name" := runModuleName (efModuleName extern)
119-
, ":name" := Docs.declTitle d
120-
, ":namespace" := toIdeNamespace d
121-
, ":declaration_type" := toDeclarationType d
122-
, ":span" := Aeson.encode (Docs.declSourceSpan d)
123-
, ":docs" := Docs.declComments d
124-
, ":type" := runDocs (declAsMarkdown d)
125-
, ":declaration" := show d
126-
]
127-
128-
129-
for_ (declChildren d) $ \ch -> do
130-
SQLite.executeNamed conn
131-
("insert into declarations (module_name, name, namespace, span, docs, declaration) " <>
132-
"values (:module_name, :name, :namespace, :span, :docs, :declaration)")
133-
[ ":module_name" := runModuleName (efModuleName extern)
134-
, ":name" := Docs.cdeclTitle ch
135-
, ":namespace" := childDeclInfoNamespaceIde (Docs.cdeclInfo ch)
136-
, ":span" := Aeson.encode (Docs.declSourceSpan d)
137-
, ":docs" := Docs.cdeclComments ch
138-
, ":declaration" := show d
139-
]
140-
)
141-
142-
143-
for_ (Docs.modReExports docs) $ \rexport -> do
144-
for_ (snd rexport) $ \d -> do
145-
SQLite.executeNamed conn
146-
("insert into declarations (module_name, name, rexported_from, declaration_type, span, type, docs, declaration)" <>
147-
"values (:module_name, :name, :rexported_from, :declaration_type, :span, :type, :docs, :declaration)"
148-
)
149-
[ ":module_name" := runModuleName (efModuleName extern)
150-
, ":name" := Docs.declTitle d
151-
, ":rexported_from" := ("HOLAS" :: Text) --runModuleName (Docs.ignorePackage (fst rexport))
152-
, ":declaration_type" := toDeclarationType d
153-
, ":span" := Aeson.encode (Docs.declSourceSpan d)
154-
, ":docs" := Docs.declComments d
155-
, ":type" := runDocs (declAsMarkdown d)
156-
, ":declaration" := show d
157-
]
158-
159111
SQLite.close conn
160112
return ()
161113
where
@@ -201,20 +153,6 @@ sqliteInit outputDir = liftIO $ do
201153
, ")"
202154
]
203155

204-
SQLite.execute_ conn $ SQLite.Query $ Text.pack $ unlines
205-
[ "create table if not exists declarations ("
206-
, " module_name text references modules(module_name) on delete cascade,"
207-
, " name text not null,"
208-
, " namespace text,"
209-
, " declaration_type text,"
210-
, " rexported_from text,"
211-
, " type text,"
212-
, " docs text,"
213-
, " span text,"
214-
, " declaration text not null"
215-
, ")"
216-
]
217-
218156
SQLite.execute_ conn $ SQLite.Query $ Text.pack $ unlines
219157
[ "create table if not exists asts ("
220158
, " module_name text references modules(module_name) on delete cascade,"
@@ -232,13 +170,9 @@ sqliteInit outputDir = liftIO $ do
232170
, ")"
233171
]
234172

235-
SQLite.execute_ conn "create index if not exists dm on declarations(module_name)"
236-
SQLite.execute_ conn "create index if not exists dn on declarations(name);"
237-
238173
SQLite.execute_ conn "create index if not exists asts_module_name_idx on asts(module_name);"
239174
SQLite.execute_ conn "create index if not exists asts_name_idx on asts(name);"
240175

241-
242176
SQLite.execute_ conn "create index if not exists exports_name_idx on exports(name);"
243177
SQLite.execute_ conn "create index if not exists exports_module_name_idx on exports(module_name);"
244178

0 commit comments

Comments
 (0)