Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slow speed for import library #2

Open
juncaofish opened this issue Dec 13, 2016 · 1 comment
Open

slow speed for import library #2

juncaofish opened this issue Dec 13, 2016 · 1 comment

Comments

@juncaofish
Copy link

Test Code with built firmware on LinkIt

import time
t = time.time()
import json
j = time.time()
print "import json cost:", j-t
import requests
r = time.time()
print "import requests cost:", r-j
import base64
b = time.time()
print "import base64 cost:", b-r

Result:
import json cost: 0.510145187378
import requests cost: 14.6618149281
import base64 cost: 0.00102591514587

Any idea?

@xiongyihui
Copy link
Contributor

Importing module is quite slow on MT7688 indeed. There are several reasons:

  1. SPI Flash R/W is very low.
  2. Many modules are not pre-compiled to byte-code due to space limitation.
  3. MT7688 is slow.

Using a SD card as extroot may improve the performance as SDIO is faster than SPI.
With a SD card, more space will be available. Compiling python modules to byte-code will also increase loading speed. To do so:

python -m compileall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants