2008/10/1 Claude Heiland-Allen claudiusmaximus@goto10.org:
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.
Claudius, this is awesome. I'm going to build this later and see how it does with my stuff, which has become a nightmare to work with (5-10 layers of depth, tons of instances, 3-15 minute loadtimes) (of course, it's sufficiently fun after loading to engender my patience thus far : )).
I'll post my results Best Luke
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.
#N canvas 0 0 450 300 10; #X obj 28 24 inlet; #X obj 33 262 outlet;
#N canvas 0 0 450 300 10; #X obj 8 9 layer_0; #X obj 8 29 layer_0; #X obj 8 49 layer_0; #X obj 8 69 layer_0; #X obj 8 89 layer_0; #X obj 8 109 layer_0; #X obj 8 129 layer_0; #X obj 8 149 layer_0; #X obj 8 169 layer_0; #X obj 8 189 layer_0; #X obj 8 209 layer_0; #X obj 8 230 layer_0; #X obj 8 250 layer_0; #X obj 8 270 layer_0; #X obj 68 9 layer_0; #X obj 68 29 layer_0; #X obj 68 49 layer_0; #X obj 68 69 layer_0; #X obj 68 89 layer_0; #X obj 68 109 layer_0; #X obj 68 129 layer_0; #X obj 68 149 layer_0; #X obj 68 169 layer_0; #X obj 68 189 layer_0; #X obj 68 209 layer_0; #X obj 68 230 layer_0; #X obj 68 250 layer_0; #X obj 68 270 layer_0; #X obj 128 9 layer_0; #X obj 128 29 layer_0; #X obj 128 49 layer_0; #X obj 128 69 layer_0; #X obj 128 89 layer_0; #X obj 128 109 layer_0; #X obj 128 129 layer_0; #X obj 128 149 layer_0; #X obj 128 169 layer_0; #X obj 128 189 layer_0; #X obj 128 209 layer_0; #X obj 128 230 layer_0; #X obj 128 250 layer_0; #X obj 128 270 layer_0; #X obj 188 9 layer_0; #X obj 188 29 layer_0; #X obj 188 49 layer_0; #X obj 188 69 layer_0; #X obj 188 89 layer_0; #X obj 188 109 layer_0; #X obj 188 129 layer_0; #X obj 188 149 layer_0; #X obj 188 169 layer_0; #X obj 188 189 layer_0; #X obj 188 209 layer_0; #X obj 188 230 layer_0; #X obj 188 250 layer_0; #X obj 188 270 layer_0; #X obj 248 9 layer_0; #X obj 248 29 layer_0; #X obj 248 49 layer_0; #X obj 248 69 layer_0; #X obj 248 89 layer_0; #X obj 248 109 layer_0; #X obj 248 129 layer_0; #X obj 248 149 layer_0; #X obj 248 169 layer_0; #X obj 248 189 layer_0; #X obj 248 209 layer_0; #X obj 248 230 layer_0; #X obj 248 250 layer_0; #X obj 248 270 layer_0; #X obj 308 9 layer_0; #X obj 308 29 layer_0; #X obj 308 49 layer_0; #X obj 308 69 layer_0; #X obj 308 89 layer_0; #X obj 308 109 layer_0; #X obj 308 129 layer_0; #X obj 308 149 layer_0; #X obj 308 169 layer_0; #X obj 308 189 layer_0; #X obj 308 209 layer_0; #X obj 308 230 layer_0; #X obj 308 250 layer_0; #X obj 308 270 layer_0; #X obj 368 9 layer_0; #X obj 368 29 layer_0; #X obj 368 49 layer_0; #X obj 368 69 layer_0; #X obj 368 89 layer_0; #X obj 368 109 layer_0; #X obj 368 129 layer_0; #X obj 368 149 layer_0; #X obj 368 169 layer_0; #X obj 368 189 layer_0; #X obj 368 209 layer_0; #X obj 368 230 layer_0; #X obj 368 250 layer_0; #X obj 368 270 layer_0;
#N canvas 0 0 450 300 10; #X obj 8 9 layer_1; #X obj 8 29 layer_1; #X obj 8 49 layer_1; #X obj 8 69 layer_1; #X obj 8 89 layer_1; #X obj 8 109 layer_1; #X obj 8 129 layer_1; #X obj 8 149 layer_1; #X obj 8 169 layer_1; #X obj 8 189 layer_1; #X obj 8 209 layer_1; #X obj 8 230 layer_1; #X obj 8 250 layer_1; #X obj 8 270 layer_1; #X obj 68 9 layer_1; #X obj 68 29 layer_1; #X obj 68 49 layer_1; #X obj 68 69 layer_1; #X obj 68 89 layer_1; #X obj 68 109 layer_1; #X obj 68 129 layer_1; #X obj 68 149 layer_1; #X obj 68 169 layer_1; #X obj 68 189 layer_1; #X obj 68 209 layer_1; #X obj 68 230 layer_1; #X obj 68 250 layer_1; #X obj 68 270 layer_1; #X obj 128 9 layer_1; #X obj 128 29 layer_1; #X obj 128 49 layer_1; #X obj 128 69 layer_1; #X obj 128 89 layer_1; #X obj 128 109 layer_1; #X obj 128 129 layer_1; #X obj 128 149 layer_1; #X obj 128 169 layer_1; #X obj 128 189 layer_1; #X obj 128 209 layer_1; #X obj 128 230 layer_1; #X obj 128 250 layer_1; #X obj 128 270 layer_1; #X obj 188 9 layer_1; #X obj 188 29 layer_1; #X obj 188 49 layer_1; #X obj 188 69 layer_1; #X obj 188 89 layer_1; #X obj 188 109 layer_1; #X obj 188 129 layer_1; #X obj 188 149 layer_1; #X obj 188 169 layer_1; #X obj 188 189 layer_1; #X obj 188 209 layer_1; #X obj 188 230 layer_1; #X obj 188 250 layer_1; #X obj 188 270 layer_1; #X obj 248 9 layer_1; #X obj 248 29 layer_1; #X obj 248 49 layer_1; #X obj 248 69 layer_1; #X obj 248 89 layer_1; #X obj 248 109 layer_1; #X obj 248 129 layer_1; #X obj 248 149 layer_1; #X obj 248 169 layer_1; #X obj 248 189 layer_1; #X obj 248 209 layer_1; #X obj 248 230 layer_1; #X obj 248 250 layer_1; #X obj 248 270 layer_1; #X obj 308 9 layer_1; #X obj 308 29 layer_1; #X obj 308 49 layer_1; #X obj 308 69 layer_1; #X obj 308 89 layer_1; #X obj 308 109 layer_1; #X obj 308 129 layer_1; #X obj 308 149 layer_1; #X obj 308 169 layer_1; #X obj 308 189 layer_1; #X obj 308 209 layer_1; #X obj 308 230 layer_1; #X obj 308 250 layer_1; #X obj 308 270 layer_1; #X obj 368 9 layer_1; #X obj 368 29 layer_1; #X obj 368 49 layer_1; #X obj 368 69 layer_1; #X obj 368 89 layer_1; #X obj 368 109 layer_1; #X obj 368 129 layer_1; #X obj 368 149 layer_1; #X obj 368 169 layer_1; #X obj 368 189 layer_1; #X obj 368 209 layer_1; #X obj 368 230 layer_1; #X obj 368 250 layer_1; #X obj 368 270 layer_1;
Pd-dev mailing list Pd-dev@iem.at http://lists.puredata.info/listinfo/pd-dev