Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: More Effecient Method Chaining

by jcb (Parson)
on Apr 23, 2021 at 23:14 UTC ( [id://11131675] : note . print w/replies, xml ) Need Help??


in reply to More Effecient Method Chaining

First, run the script as it is with top in another window. We will need to know if gst-inspect-1.0 is actually burning half a second or so of CPU time or just spending most of its time blocked for some strange reason. If it is "blocky", running many instances in parallel will result in a huge performance improvement. If it is wasteful, running many instances in parallel will only help to the limit of your available hardware threads.

A better option may be to cache the gst plugins in a simple database. There is an SDBM module bundled with Perl that provides tied persistent hashes with a few limitations, most notably that each record (key and value) can be no larger than about 1KB. There are other DBM modules also available, but SDBM is self-contained and the others require relevant libraries be available when Perl is built.

If DBM is insufficient or unavailable, DBI provides SQL database bindings, with the DBD::SQLite backend bundling the required SQLite.

I have used both SDBM and SQLite in the past, with the deciding factor being the application. Since you do not mention what you seek to accomplish, I cannot really recommend one over the other for you.