[PD-dev] abstraction caching
Claude Heiland-Allen
claudiusmaximus at goto10.org
Wed Oct 1 12:59:41 CEST 2008
Benchmarking an Abstraction Cache for Pd
========================================
I implemented a rudimentary abstraction caching mechanism for Miller
Puckette's pd-0.41-4, which stores the parsed text ("binbuf") associated
with the class name instead of looking for files to load every time it
is instantiated.
Benchmark Mechanism
-------------------
Run 4 times, discarding first report:
$ time pd -open layer_2.pd -send "; pd quit" &>/dev/null
layer_2.pd contains 99 layer_1.pd contains 99 layer_0.pd,
total 9901 = 9801 layer 0 + 99 layer 1 + 1 layer 0
Results: Without Cache
----------------------
real 0m0.524s
user 0m0.260s
sys 0m0.256s
real 0m0.530s
user 0m0.224s
sys 0m0.276s
real 0m0.527s
user 0m0.224s
sys 0m0.296s
Results: With Cache
-------------------
real 0m0.082s
user 0m0.068s
sys 0m0.004s
real 0m0.148s
user 0m0.120s
sys 0m0.008s
real 0m0.085s
user 0m0.052s
sys 0m0.012s
Conclusion
----------
Abstraction cache gives a speed boost of more than 500% when loading
patches containing a large number of abstractions.
Further Work
------------
The main drawback (and the easiest issue to resolve) of the current
implementation is that once an abstraction is in the cache, it stays
there forever, no matter if the file is modified within or without Pd.
This could be fixed by flushing the cache immediately after the patch
is loaded (perhaps using Pd's scheduler).
Another drawback are that abstractions in different directories with
the same file name can clobber each other - the first one loaded is the
"one true abstraction" with that name, resolving this issue will be more
difficult.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pd-0.41-4_abstraction_cache.patch
Type: text/x-patch
Size: 3414 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20081001/9adf2956/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: layer_0.pd
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20081001/9adf2956/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: layer_1.pd
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20081001/9adf2956/attachment.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: layer_2.pd
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20081001/9adf2956/attachment-0001.txt>
More information about the Pd-dev
mailing list