alibaba / alibaba/AliOS-Things

ASOC2022: AliOS Things中多语言交互性能优化(C与Python间相互访问)

Open
#1,722 1 comment 0 reactions 0 assignees View on GitHub
ASOC2022 community
Dominant language
C
Stars
4.6k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

# AliOS Things中多语言交互性能优化(C与Python间相互访问)

## 项目描述
嵌入式领域中最早是使用汇编语言进行编程,但汇编语言入门门槛很高;C/C++的出现降低嵌入式领域入门门槛的同时也提高了开发效率。和C/C++开发相比,Python的开发门槛更低,开发效率更高。但Python语言并不能直接操作硬件,所以Python语义需要经过Python引擎的翻译转换成对C/C++语言或汇编语言实现API的调用才能运行。
本项目则是对C和Python的双向通信进行优化,如下题目可以任选其一进行优化:
1. Python到C的优化:对Python引擎进行优化提高Python语句的运行效率
2. C到Python的优化:产生中断后C语言调用Python注册的回调机制优化,提高C到Python消息的传递效率
3. 使用Python不可避免的会占用更多的内存,请思考并调研Python引擎中内存如何进行优化

In the embedded field, assembly language was first used for programming, but the entry threshold for assembly language was very high; the emergence of C/C++ lowered the entry threshold in the embedded field and improved development efficiency. Compared with C/C++ development, Python has a lower development threshold and higher development efficiency. However, the Python language cannot directly operate the hardware, so the Python semantics needs to be translated by the Python engine into a call to the C/C++ language or assembly language implementation API to run. This project is to optimize the two-way communication between C and Python. The following topics can be selected for optimization:
1. Python to C optimization: optimize the Python engine to improve the efficiency of Python statements
2. Optimization from C to Python: After an interrupt is generated, the C language calls the callback mechanism registered by Python to improve the efficiency of message transmission from C to Python
3. Using Python will inevitably take up more memory, please think about and investigate how to optimize the memory in the Python engine

## 项目备注
在[HaaS EDU K1](https://haas.iot.aliyun.com/solution/detail/hardware?versionId=800C5AB3B8A4A88800000001&dataId=800C5AB3B8A4A888)上对[HaaS Python](https://haas.iot.aliyun.com/haasapi/index.html#/)引擎进行优化,HaaS Python是基于MicroPython扩展的云端一体轻应用开发框架,通过haaS Python可以快速连接到阿里云物联网平台。
原始代码仓库位置:https://github.com/alibaba/AliOS-Things/tree/rel_3.3.0
HaaS Python解决方案:https://github.com/alibaba/AliOS-Things/tree/rel_3.3.0/solutions/py_engine_demo
MIcroPython原理介绍:[第一节](https://zhuanlan.zhihu.com/p/370431876)、[第二节](https://zhuanlan.zhihu.com/p/371901668)、[第三节](https://zhuanlan.zhihu.com/p/374416150)、[第四节](https://zhuanlan.zhihu.com/p/375085023)
MicroPython中断回调机制:[链接](https://developer.aliyun.com/article/787979)

This optimization is based on HaaS EDU K1. HaaS Python is a AIoT application development framework based on MicroPython. HaaS Python can be used to connect to the Alibaba Cloud IoT platform.
Original code repository location: https://github.com/alibaba/AliOS-Things/tree/rel_3.3.0
Solution: https://github.com/alibaba/AliOS-Things/tree/rel_3.3.0/solutions/py_engine_demo

## 项目产出要求:
1. 任选一个方向进行深入研究并生成优化的patch以及优化前后性能指标

1. Choose one direction to conduct in-depth research and generate optimized patches and performance indicators before and after optimization

## 项目难度
基础

Contributor guide

Open the contributing guide

Research direction

Start with the rel_3.3.0 AliOS-Things source and solutions/py_engine_demo, then read the linked MicroPython engine and interrupt-callback materials. Choose one of the three optimization directions, identify the relevant C/Python execution or callback path, and establish a reproducible baseline on HaaS EDU K1. Done means an optimization patch plus before-and-after performance metrics.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
embedded-iot, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.