I wonder if you had a perl daemon listening on a unix socket and had the PL/Perl module farm out some evals if that would be faster.
Does the embedded perl interperter have direct access to the datastore (some sort of shared memory) or are values 'passed in' (copied)?