-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Razor caching to drastically improve performance. #202
Conversation
Wow this sounds like a massive improvement. |
Btw AFAIK the long term strategy is to get rid of razor if possible. |
Even if eventually want to get rid of razor I would merge and publish a new version with this. It's a great improvement |
Yes that's what I think, too. Will look at it and try to release.
|
Why get rid of razor? I did like it, and it is actually very fast :) I'm not sure why the build would fail, because I use custom solution files (removed paket) and custom deps (custom RazorEngine that works on mono). It is hard for me to run the unit tests locally. But if you look into it I guess I can ignore it for now? |
Sorry it seems like I was a little bit too fast :(. |
no problem. Just tell me when it's ready to merge |
File.WriteAllText(outDir @@ (typ.UrlName + ".html"), out) | ||
Log.logf "Finished type: %s" typ.UrlName | ||
razor) | ||
//Parallel.pfor types (fun () -> RazorRender(layoutRoots, ["FSharp.MetadataFormat"])) (fun typ _ razor -> | ||
// Log.logf "Generating type: %s" typ.UrlName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please remove this dead code. thanks
The build is still failing because I used a newer version of RazorEngine, I don't know if the latest nuget version is enough, but could you try updating RazorEngine to the latest nuget version anyway? |
try the following:
|
…ilable on this version.
I tried that, but I was not able to make it work. I think the new versions are only available for net4.5 and this solution is still 4.0. But this is an issue for another time, I have added a (rather dirty) workaround for now. The rewriting of the RazorRender is now also done, so I guess this can be tested/merged? However to leverage this speed for *.md files, one would have to rewrite the ProcessDirectory logic in a way that it reuses a RazorRender instance. I don't need this as I have only a few of those. Note: It is now actually even faster than written in the first post (15 secs). |
Oh right. They moved to 4.5 |
Is there a discussion/faq why you want to move away from razor? Razor seems like a perfect fit. |
thanks to the support by @jeffhandley it's released in 2.4.26. awesome! |
AFAIK mostly because of xplat. We don't get it to work in the downstream projects. |
already using it in Paket - see fsprojects/Paket@1e824af time for docs form 18 seconds down to 4. That's awesome. Now the 10s for the md files seems like way too much ;-) |
Yeah I'm using this on mono actually... |
oh that's interesting. |
See matthid/RazorEngine@2bebf75 for details. Basically what I do is use this static field to replace the references completely with my own list:
|
do you see any chance to get this back into razor? |
I could try, but I don't think they would merge these changes, that's definitely not the way it's supposed to be done :). |
true but it's an outdated package and they do not really care about this anymore, right? I mean they don't support 4.0 any more. |
After thinking about this: |
Some notes to my patches: This will most likely introduce a whole range of bugs when someone tries to generate API docs and *.md files in parallel. |
that would be awesome ;-) 2014-09-30 14:02 GMT+02:00 matthid notifications@github.com:
|
The speed of the API reference generation (and possibly some other things) can be improved drastically by using razor caching (https://razorengine.codeplex.com/wikipage?title=Quick%20Start%20Guide).
In my case I could reduce the time to produce the docs from 600 to 21 secs!
The first two commits improve the error messages (second is a bugfix).
Maybe you should not merge this patch and instead rewrite/remove the RazorRender class to only use caching (ie. currently the class is designed around the ProcessFile function, and my extensions are currently a bit error prone), and do the generation it in parallel again.
Note: The ProcessDirectory function in FSharp.Literate could also benefit from this when ProcessFileCache is used (and CompileTemplate is called at least once).