Giter VIP home page Giter VIP logo

Comments (5)

nhirschey avatar nhirschey commented on July 23, 2024

If you're using Array.Parallel, as a first check I'd make sure that you have server GC configured. The easiest way is by setting an environment variable, see here. Server GC can substantially speed up parallel calculations, and this is not specific to fsdocs.

What outputs are you generating? If you are generating .html, .fsx, and .ipynb outputs then fsdocs will run the code 3 times. That could be part of your issue.

More generally, can you cache the chart, rather than building it each time? You could include a cached chart using regular markdown

(***do-not-eval***)
// This code will show up but it will not be evaluated
Array.Parallel.mapi veryLongFunction

(**
Some markdown text
![myChart](path-to-images/cachedChart.png)
*)

As an aside, Array.Parrallel is parallel but not Asynchronous. Async typically refers to async expressions.

from fsharp.formatting.

yigitl avatar yigitl commented on July 23, 2024

If you're using Array.Parallel, as a first check I'd make sure that you have server GC configured. The easiest way is by setting an environment variable, see here. Server GC can substantially speed up parallel calculations, and this is not specific to fsdocs.

I didn't know much about this, that's interesting.

What outputs are you generating? If you are generating .html, .fsx, and .ipynb outputs then fsdocs will run the code 3 times. That could be part of your issue.

The output is generated from an .fsx file yes. This partly explains the slowdown, as running it 3 times would cause around 3.5 hours of build time. The remaining hour or so might be caused by garbage collection or some other factors.

Why does fsdocs run .fsx files three times though? I might have missed it but I don't think I have seen this mentioned anywhere.

More generally, can you cache the chart, rather than building it each time? You could include a cached chart using regular markdown

This is what I have in mind, in case I cannot find a proper fix.

Thank you for the quick reply.

from fsharp.formatting.

nhirschey avatar nhirschey commented on July 23, 2024

Why does fsdocs run .fsx files three times though?

If you're only generating .html (the default, what it sounds like you're doing), it will run once. But fsdocs allows creating multiple outputs from a .fsx script, and it'll run once per output type. See e.g. the _template.ipynb references here.

That's how the files backing the "download in notebook" link are generated on this site's docs page, such as at the top of the creating content page I just linked to.

from fsharp.formatting.

yigitl avatar yigitl commented on July 23, 2024

If you're only generating .html (the default, what it sounds like you're doing), it will run once. But fsdocs allows creating multiple outputs from a .fsx script, and it'll run once per output type. See e.g. the _template.ipynb references here.

Right, I thought it was running it three times for other reasons. As you guessed I'm only getting an html output. Then it's still very strange to me that this function takes 4-5 times as much time only when I'm calling it from fsdocs.

from fsharp.formatting.

yigitl avatar yigitl commented on July 23, 2024

Setting the server GC actually brought the build time down to the expected duration. Thank you for the help @nhirschey.

from fsharp.formatting.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.