Lua vs python

18,196 views
17,807 views

Published on

This presentation depicts my experience that lua and python are embedded on our mobile platform. This help you understand how they are different.

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
18,196
On SlideShare
0
From Embeds
0
Number of Embeds
3,027
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide
  • Cpu & memory 에 대한 비교는 다음 사이트를 참고했음 http://dada.perl.it/shootout/craps_cpumem.html
  • http://dada.perl.it/shootout/craps_cpumemloc.html
  • Lua vs python

    1. 1. P ytho n vs L ua S K p la ne t 신호철
    2. 2. Background
    3. 3. Script for making Applications Background - The complexity of applications increased extremely. - Applications need to be applied large-scale refactoring. What can the script do ? - Can reduce code-size and increase maintainability. - Make it easy to append new applications. - When the middleware layer is modified, the modification doesn’t propagate to the application layer. It’s limited to the script-engine layer. Candidate script languages - Lua, Python
    4. 4. Lua porting
    5. 5. What’s Lua  Lua is Implemented and maintained by Tecgraf*1.  Lua has used in many industrial applications such as Adobe’s Photoshop Lightroom.  Lua is the leading scripting language in games.  Lua is Embedded in games ( e.g. World of Warcraft ) and Ginga*2. : Tecgraf - http://www.tecgraf.puc-rio.br/*1 : Ginga brasil – 브라질향 데이터방송 규격*2
    6. 6. Why Lua  Lua is small - The source contains around 17,000 Lines of C. - All standard libraries take just 144K Bytes.  Lua is powerful - Lua provides meta-mechanisms for implementing classes and inheritance. - Lua provides garbage collection.  Lua is fast - Several benchmarks show Lua as the one of the fastest languages.  Lua is portable & embeddable - Lua is definitely easy to be embedded with small footprint.  Lua is free : MIT License*1 : MIT License - http://ko.wikipedia.org/wiki/MIT_%EB%9D%BC%EC%9D%B4%EC%84%A0%EC%8A%A4*1
    7. 7. Lua-Application Prototyping - 1/2  We ported mobile Calculator into Lua - We implemented UI Wrapper functions which are required in Calculator. - GTK-related functions and Softkey functions. - Calculator Logic is implemented by Lua script. - Main functions which is needed in 4 fundamental rules of Arithmetic are ported now. - The prototype of Lua-Calculator is successfully ported in our mobile platform.
    8. 8. Lua-Application Prototyping - 2/2  GTK mapping - Wrapper functions are implemented. - makeWindow, makeButton, makeLabel, setLabel, makeSoftkey.  Calculator Logic - 190 Lines of Lua code.  Calculator UI - 54 Lines of Lua code.  Wrapper Code & Lua script Main.c Calc.lua
    9. 9. Python porting
    10. 10. What’s Python Released first by Guido van Rossum in 1991. Now managed by Python Software Foundation*1 Embedded as a scripting language in these S/W products. *2 - GIMP, gedit, Vim, Maya etc - In mobile domain, Python for s60*3 Features a fully dynamic type, automatic memory management. *1 : Python Software Foundation – Wikipedia, http://en.wikipedia.org/wiki/Python_Software_Foundation *2 : Python-embedded S/W – Wikipedia, http://en.wikipedia.org/wiki/Python_software *3 : Python for s60 – nokia.com http://wiki.opensource.nokia.com/projects/Python_for_S60
    11. 11. Why Python Highly Readable - Python uses whitespace indentation to delimit statement blocks. Powerful Standard Library - Python has a very large standard library. Powerful Glue Language - Python has the ability to use a lower-level language such as C/C++. - Python can easily attach new modules by using ctypes*1 or swig*2, etc. Free - Python Software Foundation License*3 : Allows modifications to the source code and derivative works.*1 : Ctypes – http://www.python.org/doc/2.5/lib/module-ctypes.html*2 : Swig – http://www.swig.org*3 : Python Software Foundation License – http://en.wikipedia.org/wiki/Python_Software_Foundation_License
    12. 12. Python-Application Prototyping : Calculator To wrap gtk layer, we try to use PyGTK*1. platform-dependent functions such as Softkeys are not yet implemented by hand. Calculator UI : 114 Lines of python code - Example UI code : Y:funcalc.py : PyGTK : GTK wrapper for python - http://www.pygtk.org/*1
    13. 13. Lua vs Python
    14. 14. Lua vs Python Lua PythonBinary size about 200KB About 2MB (Lua version 5.1) (Python version 2.6)Memory usage Lua is more compactSpeed Lua is faster*1Multi-threading Thread-safe Poor-qualityStandard Library Small & compact Rich & powerfulGlue ability Easy Normal*1 : see also Lua vs Python : CPU+Memory
    15. 15. What is the most suitable for mobile applications  Lua is more compact and faster than Python. But Python is further powerful. - Python has lots of build-in modules and many open-source wrapper modules such as pyGtk.  In case of mobile application which has abundant resources, Python is the most suitable for applications.
    16. 16. Appendix
    17. 17. Lua vs Python : CPU+Memory CPU + Memory Usage + Lines of Code.

    ×