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