Community Q&A

Where Wwise users help each other out!

Audiokinetic's Community Q&A is the forum where Wwise users ask and answer questions within the Wwise community. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

Bug(?): WAAPI low-level API slow only when called in SoundBank-generation steps

0 votes

Hello Wwise, 

I found a performance issue with WAAPI when making queries in SoundBank generation steps.

Test setup

  • Version: Wwise 2019.1.1
  • OS: Windows 10
  • Python: 3.7.3
  • Project: IntegrationDemo
  • Case: Query a list of GUIDs

 

import asyncio
import cProfile as profile
import logging
import os
from os.path import abspath, dirname, join
from pprint import pprint, pformat
import sys
import traceback

from autobahn.asyncio.wamp import ApplicationSession, ApplicationRunner

sys.path.append(abspath(join(os.environ['WWISEROOT'], 'SDK/include/AK/WwiseAuthoringAPI/py')))
from ak_autobahn import AkComponent
from waapi_uri import WAAPI_URI


_guids = [
    '{3C874205-5335-4290-830F-A8BFF3AE8A6B}',
    '{AB619779-DBCA-455C-B1FA-3DA0D1BFEAF1}',
    '{D9391B7B-44F2-49E3-8756-9A592468BDAA}',
    '{5034CAD2-36B1-41F8-8249-CA8FBF8AD4AE}',
    '{BB5E4307-3363-43FD-B5FA-091526E189F2}',
    '{AB619779-DBCA-455C-B1FA-3DA0D1BFEAF1}',
    '{2A19ADA9-B6C0-4C4F-AD5A-E811629C83B5}',
    '{587FB8C3-591C-469F-87BF-7334E1821AB4}',
    '{AB9BBA39-26FD-4D6A-8A4F-C8FD6F3DCA89}',
    '{37B800E1-46C8-4DB3-AB5F-94C347246482}',
    '{DBFC4B0F-5772-47B6-A148-C51FF4CCD4A1}',
    '{7BC999C0-23E5-4890-A698-5D10150DA19B}',     
    .....
    # total 105 GUIDs collected from the test project, cut short due to size limit of this post.
]


class MyComponent(AkComponent):
    def onJoin(self, details):
        for guid in _guids:
            query = {
                "from": {"id": [guid]},
                "options": {"return": ["id", "name", "type"]}
            }
            try:
                result = yield from self.call(WAAPI_URI.ak_wwise_core_object_get, **query)
            except Exception as err:
                # traceback.print_exc()
                pass
        self.leave()

    def onDisconnect(self):
        # print("The client was disconnected.")
        asyncio.get_event_loop().stop()


def main():
    runner = ApplicationRunner(url=u"ws://127.0.0.1:8080/waapi", realm=u"realm1")
    try:
        runner.run(MyComponent)
    except Exception as e:
        pass


if __name__ == '__main__':
    profile.runctx('from __main__ import main; print(main())', globals(), locals())
 

With my setup, it takes less than 0.1 second to run through the script from a command prompt;

however, it takes around 10 seconds to finish the same script as a Global Closing Step.

From Python's instrumentation I fail to see an obvious bottleneck unfortunately. I had a few suspects but kinda ruled them out:

  1. buffered I/O: but even with non-buffered I/O (-u option of Python) and without all the prints, it still takes that long. 
  2. Python interpreter loading time: Having more queries in a bigger script that involves other computing tells me that it's still the query itself that takes long. 

It's almost like the async calls were blocked. Would you know if this is a known limitation?

 

UPDATE

New findings after a few tries

  1. The script runs at an expected speed with WwiseCLI from commandline. The slowdown only happens when generating banks in Wwise Authoring.
  2. In Wwise Authoring, the script runs slow even when using a separate thread and a new asyncio event loop in that thread. 

 

 

asked Jun 28 in Feature Requests by Beinan Li 李北南 (160 points)
edited Jul 5 by Beinan Li 李北南

Please sign-in or register to answer this question.

...