The use of addslashes() in sqlite3 is problematic, should be changed to $db->escapeSimple() or equivalent. There are also several places where sql insertions include " instead of ' and sqlite3 does not like this.
When running in quietmode, used for either calls that don't display the frames or light weight ajax calls, there are many notification panel checks that do not need to be done as they will never be presented.
There are several code paths in a single load that call module_getinfo(). Each time this is called the entire set of module.xml files are parsed and transformed from their xml to an internal array. This is very expensive and adds a significant performance penalty. It is particularly noticeable on light weight appliances such as embedded low power environments. In normal circumstances, the only time the module.xml files need to be read is when going to Module Admin where you may be checking for updates or may have loaded a new module. Normal use has no need to read and parse the files each time. The array, once created, should be parsed and serialized in a db cache so that normal operation need only read the cached copy.
When doing calls such as ajax call that need to be very light weight, every single module's functions.inc.php do not necessarily need to be read in and a module should be able to specify a minimum set to be included. In addition, during quietmode (which is used for such calls and other uses) there are many includes parsed looking for hooks that don't need to be processed as these calls are special purpose and don't have a need for such. (at least they don't today and if they did, then a different call should be created to provide it).