You Are Here:

Community: Developer Discussion Boards

#1 Old Tip: Loading modules in a background thread - 2006-02-26, 18:08

Join Date: Oct 2004
Posts: 158
bercobeute
Offline
Regular Contributor
Just a tip others might find usefull.

My rather large app (>1k lines) imports a huge list of modules. This really slowed down the start of the application. One solution could be to import the module once they are needed, but another solution would be to import the modules that are not immediately needed in the background. For instance when showing a splash screen. This is how I accomplish that:

Code:
def importRest():
    os, key_codes, time, audio, location, socket, urllib =[__import__('os'), 
                                                           __import__('key_codes'),
                                                           __import__('time'),
                                                           __import__('audio'),
                                                           __import__('location'),
                                                           __import__('socket'),
                                                           __import__('urllib')]
thread.start_new_thread(importRest,())
I haven't tested it thoroughly, but it seems to speed up the start of the application considerably.
Reply With Quote

#2 Old Re: Tip: Loading modules in a background thread - 2006-02-27, 06:19

Join Date: Sep 2005
Posts: 314
Location: Finland, Helsinki
aaaaapo
Offline
Regular Contributor
Quote:
Originally Posted by bercobeute
My rather large app (>1k lines) imports a huge list of modules. This really slowed down the start of the application. One solution could be to import the module once they are needed, but another solution would be to import the modules that are not immediately needed in the background.
I have a similar annoyance: starting up my (>2k lines, about 10 files + 10 pys60 library imports) app takes normally more than 8 seconds.

I've been thinking about some kind of splashscreen and/or progressbar to show user that application is starting up. But this is just a thought yet...
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Link errors when trying to Display bitmap Bkc82 Symbian Media (Graphics & Sounds) 1 2006-01-16 23:46
Thread function not being called kamalsinghania General Symbian C++ 5 2006-01-04 13:28
Can midlet run in the background thread? crazyII Mobile Java General 4 2003-11-26 15:38
Creating a background thread pawel_z General Symbian C++ 7 2003-10-08 17:33
Thread Kalderas General Symbian C++ 4 2003-08-14 16:02

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia