Piwik performance related

Hi,
We are customizing piwik, to construct chart based on data available in our DB. Thought the query to pull data from DB is optimized, coniderable time is taken for the flash chart to load. Is there any tip that could speed up chart construction

Thanks