Created
January 12, 2019 10:17
-
-
Save GULPF/dc97e5e745842138556d882c17d97718 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NOTE: The imports are found by simple walking throught the AST and looking after `nkFromStmt` and `nkImportStmt` nodes. | |
The stdlib modules are identified by simple string comparisions. | |
This method is not entirely accurate, but it does give some indication of which modules are used and which are not. | |
File imports (tot: 14078) | |
0 volatile | |
0 db_odbc | |
0 asyncftpclient | |
0 punycode | |
0 ssl | |
0 channels | |
1 varints | |
1 threads | |
1 unidecode | |
1 chains | |
1 strmisc | |
2 cstrutils | |
2 sexp | |
2 cpuload | |
2 rtarrays | |
2 matchers | |
2 parsejson | |
2 oswalkdir | |
2 sharedtables | |
2 distros | |
3 rlocks | |
3 ftpclient | |
4 parsesql | |
4 scgi | |
4 rationals | |
4 asyncjs | |
4 xmldomparser | |
4 sharedlist | |
4 linenoise | |
5 coro | |
6 highlite | |
6 rstast | |
6 rstgen | |
6 db_mysql | |
7 httpserver | |
8 lenientops | |
8 xmldom | |
9 nimscript | |
9 rst | |
9 cookies | |
9 heapqueue | |
9 db_postgres | |
10 selectors | |
10 nimprof | |
11 fenv | |
12 smtp | |
13 parsexml | |
13 subexes | |
14 bitops | |
14 xmlparser | |
15 complex | |
15 browsers | |
15 mersenne | |
16 htmlparser | |
17 jsconsole | |
17 mimetypes | |
18 db_common | |
19 encodings | |
19 lexbase | |
20 asyncstreams | |
21 asyncio | |
21 parsecsv | |
22 cpuinfo | |
22 memfiles | |
23 queues | |
25 asyncfile | |
25 oids | |
30 dynlib | |
32 jsffi | |
33 stats | |
33 htmlgen | |
35 critbits | |
36 rdstdin | |
38 sha1 | |
40 ropes | |
42 sockets | |
46 strscans | |
47 xmltree | |
51 marshal | |
51 system | |
51 colors | |
52 lists | |
52 typeinfo | |
54 cgi | |
57 md5 | |
61 asyncfutures | |
61 nre | |
62 dom | |
63 locks | |
64 endians | |
67 deques | |
71 db_sqlite | |
75 pegs | |
79 parsecfg | |
81 httpcore | |
84 nativesockets | |
89 intsets | |
92 parseopt | |
92 asynchttpserver | |
94 uri | |
96 base64 | |
110 winlean | |
129 ospaths | |
132 threadpool | |
144 re | |
156 terminal | |
164 sugar | |
165 asyncnet | |
180 net | |
200 unicode | |
206 logging | |
207 util | |
207 parseutils | |
210 httpclient | |
232 hashes | |
238 strtabs | |
254 typetraits | |
283 sets | |
289 osproc | |
396 algorithm | |
432 strformat | |
475 options | |
493 random | |
531 asyncdispatch | |
542 streams | |
755 json | |
841 times | |
874 macros | |
933 unittest | |
1203 math | |
1247 sequtils | |
1327 tables | |
1779 os | |
3422 strutils | |
Repo imports (tot: 1015) | |
0 volatile | |
0 db_odbc | |
0 asyncftpclient | |
0 punycode | |
0 ssl | |
0 channels | |
1 nimscript | |
1 sexp | |
1 varints | |
1 matchers | |
1 threads | |
1 unidecode | |
1 chains | |
1 strmisc | |
2 cstrutils | |
2 parsesql | |
2 asyncjs | |
2 cpuload | |
2 rtarrays | |
2 coro | |
2 rlocks | |
2 parsejson | |
2 oswalkdir | |
2 xmldomparser | |
2 sharedlist | |
2 sharedtables | |
2 distros | |
3 scgi | |
3 rationals | |
3 ftpclient | |
4 rstast | |
4 subexes | |
4 asyncfutures | |
4 lenientops | |
4 linenoise | |
5 highlite | |
5 asyncstreams | |
5 rstgen | |
5 xmldom | |
6 complex | |
6 heapqueue | |
6 httpserver | |
6 db_mysql | |
7 selectors | |
7 rst | |
7 db_common | |
7 cookies | |
7 lexbase | |
8 asyncio | |
8 smtp | |
9 fenv | |
9 jsconsole | |
9 nimprof | |
9 cpuinfo | |
9 db_postgres | |
9 ropes | |
10 parsexml | |
10 mersenne | |
10 queues | |
11 browsers | |
11 stats | |
12 bitops | |
12 memfiles | |
12 mimetypes | |
13 htmlparser | |
14 encodings | |
14 xmlparser | |
14 sockets | |
15 jsffi | |
15 asyncfile | |
15 critbits | |
16 oids | |
17 rdstdin | |
17 parsecsv | |
18 strscans | |
19 system | |
20 typeinfo | |
20 dynlib | |
20 htmlgen | |
21 sha1 | |
23 marshal | |
24 intsets | |
25 nre | |
26 colors | |
26 db_sqlite | |
28 lists | |
30 dom | |
31 md5 | |
32 cgi | |
32 xmltree | |
33 nativesockets | |
34 httpcore | |
36 locks | |
38 pegs | |
39 parsecfg | |
39 deques | |
43 endians | |
43 asynchttpserver | |
44 util | |
45 winlean | |
46 sugar | |
50 uri | |
58 base64 | |
61 logging | |
61 ospaths | |
62 threadpool | |
63 parseopt | |
71 re | |
72 asyncnet | |
80 unicode | |
84 strtabs | |
88 terminal | |
90 parseutils | |
92 net | |
102 httpclient | |
102 hashes | |
102 sets | |
105 typetraits | |
113 options | |
133 strformat | |
145 asyncdispatch | |
147 osproc | |
172 algorithm | |
179 random | |
186 streams | |
211 json | |
273 unittest | |
278 macros | |
308 math | |
314 times | |
328 sequtils | |
378 tables | |
536 os | |
719 strutils |
wouldn't a compiler hook be easier/more accurate?
More accurate - yes. Easier - no idea. The current code is just ~30 lines of tree traversal code. This is not something I currently plan on developing further, hence why I haven't uploaded the code for finding the imports.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be quite useful to add a compiler hook that gets called whenever foo imports bar; with that we can for eg generate import DAG and answer questions like:
baz
get imported?example of compile hook:
graph.onDefinition = writeUsage
(see nimfind.nim)are these direct imports?
if so, another metric would be reporting numbers after applying transitive closure; eg if module
foo
is imported bysequtils
ditto with include instead of import