Comments (3)
Hi, thank you for your question. Could you perhaps provide the example data that is slow to resolve? I plan to change the interface of haskell-names
to get rid of haskell-packages
and provide a function
resolve :: Map ModuleName [Symbol] -> [Module l] -> ([Module (Scoped l)], Map ModuleName [Symbol])
Given an environment (a map from module name to the list of symbols it exports) and a list of modules it returns two things: a list of annotated modules and a map that for each of the given modules contains the list of symbols it exports.
Would this help you to keep the interfaces for exported modules instead of recomputing them?
Finally to answer your original question, it is probably possible to gain speedups by parallelizing but this is not yet on my agenda.
from haskell-names.
Hi Philipp,
Thanks for replying back. Well, I'm experiencing my performance issues on trying to parse and then resolve names in a source tree of around 6000 haskell files. To do so, I'm currently using the following:
annotateFiles :: [FilePath] -> IO [Module (Scoped SrcSpanInfo)]
annotateFiles srcFiles = do
asts <- {-# SCC "parse_asts" #-}
mapConcurrently (fromParseResult <$> parseFile >=> evaluate) srcFiles
{-# SCC "eval_moduleT" #-} evalNamesModuleT (buildScopes asts) []
where
buildScopes asts = do
{-# SCC "moduleT_compute_interfaces" #-}
void $ computeInterfaces Haskell2010 [] asts
{-# SCC "moduleT_annotate_module" #-}
mapM (annotateModule Haskell2010 [] ) asts
Unfortunately, running this function on my 6000 files haskell source tree, takes around 60 seconds (45 seconds of which are spent in buildScopes
). And this is why I was wondering if there is a way to optimize this. I think it should be possible to at least run the annotateModule
in parallel over all asts. Ideally, I would want to run a parList rdeepseq
strategy from Control.Parallel.Strategies
, but unfortunately haskell-src-exts
ASTs cannot be forced to normal form.
To this end, changing the interface as proposed by you would certainly make things easier to use! Because then I could iteratively refine the the computed interfaces of exported symbols. (e.g., I would run resolve
once in the beginning and then run it again to refine just the interfaces of changed haskell files, but leave most of them as is). So yea, I would be using it! :-)
from haskell-names.
Hi, I have finally release a version with the proposed interface to hackage.
from haskell-names.
Related Issues (20)
- Resolving local function's type signatures
- Bump-up to 'haskell-src-exts-1.20.1' (also support build with stack) HOT 2
- Is there a tool to update the data/baseEnvironment files? HOT 3
- haskell-src-exts dependency HOT 4
- Tests fail (new aeson?) probably due to json field ordering
- GADT constructors not Value Binders
- Promoted names annotated in wrong context
- In tests/annotations/FnBind.hs, shouldn't f be global? HOT 1
- Add haskell-names back to stackage HOT 4
- test failure, missing extra-source-file HOT 2
- Return computed tables with annotate HOT 2
- Rename `Symbol` to `Entity`.
- Overlapping instances for GTraversable HOT 1
- Remember providence of Punned and Wildcarded named HOT 4
- Document `resolve` behaviour better HOT 2
- Allow to pass -XNoImplicitPrelude to 'importTable' explicitly
- Support QuasiQuotes scoping
- Support recent versions of aeson and traverse-with-class
- Doesn't resolve TemplateHaskell splices and top-level usages
- Please, release 0.9.0 version HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from haskell-names.