OK, I did a little more spelunking and it seems that get-doc and get-metas 
are basically already pagenode-accepting sugar for cached-doc and 
cached-metas.

So maybe the speed gains I saw in the commit I linked were mostly due to 
the parts where I replaced calls to dynamic-require. 

This being the case, now I'm wondering why cached-doc and cached-metas are 
even provided!

On Sunday, December 3, 2017 at 12:39:41 AM UTC-6, Joel Dueck wrote:
>
> Finally got around to using[1] cached-doc and cached-metas to get some 
> nice speed improvements[2].
>
> I hit a tiny speed bump early on because I didn’t read carefully and I 
> thought these functions were essentially drop-in replacements for get-doc 
> and get-metas. But there are two differences:
>
>    1. The get-* functions will accept a pagenode or a path/string, but 
>    the cached-* functions will only accept a path/string
>    2. The get-* functions take an argument pointing at the *output* 
>    filename (when using a pagenode), but the cached-* functions expect 
>    their argument to point at the *source* filename (like get-doc does 
>    when you pass it a path/string)
>
> So, once I understood that, I got it working. Instead of (get-doc 
> pagenode) you would do (cached-doc (get-source pagenode)). (And also require 
> pollen/file to get get-source — but in my case I was already requiring 
> that module anyway.)
>
> But, I have some questions.
>
>    - Would you consider a change (or a pull request) to allow the cached-* 
>    functions to accept a pagenode, just like the get-* functions do?
>    - If not, would it be worth updating the docs for pollen/cache to make 
>    clear that the cached-* functions expect their pathish argument to point 
> at 
>    a source file? The argument is of course named source-path, but that still 
>    feels 
>    - It seems there is a function, cached-require, that is provided by 
>    pollen/cache but not documented, could this be included in the docs? 
>    I’m curious what one might use it for.
>
>
> [1]: 
> https://github.com/otherjoel/thenotepad/commit/4ab4b35f76c5e03ba7328c56ce6fb4f29fca1977
>
> [2]:
> # before
> rendering feed.xml
> rendering: /feed.xml.pp as /feed.xml
> cpu time: 46608 real time: 47739 gc time: 14776
>
> # after
> rendering feed.xml
> rendering: /feed.xml.pp as /feed.xml
> cpu time: 15840 real time: 15889 gc time: 5988
>

-- 
You received this message because you are subscribed to the Google Groups 
"Pollen" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to