zoukankan      html  css  js  c++  java
  • 性能测试(micropython运行环境)

    machine_capability.py

    #!/usr/bin/env python
    # -*- coding: GBK -*-
    import utime
    
    def capability(n):             
        r=1           
        t1=utime.ticks_us()                     
        while n>1:                  
            r=r*n                 
            n=n-1                 
        t2=utime.ticks_us()                          
        print('@spend time:', utime.ticks_diff(t2,t1), 'us')                                     
        #return r
    
    if __name__ == '__main__':
        capability(1000)

    运行环境:STM32H743VIT6,主频:400MHZ,RAM:1M,FLASH:2M

    运行结果:

    >>> capability(100)
    @spend time: 356 us
    >>> capability(1000)
    @spend time: 19782 us
    >>> capability(50000)
    @spend time: 59523436 us
    >>> capability(60000)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "<stdin>", line 7, in capability
    MemoryError: memory allocation failed, allocating 68546 bytes

    运行环境:ESP32,FLASH:4M

    运行结果:

    >>> 
    MicroPython ESP32_LoBo_v3.2.16 - 2018-05-15 on M5Stack with ESP32
    Type "help()" for more information.
    >>> capability(100)
    @spend time: 3116 us
    >>> capability(1000)
    @spend time: 135566 us
    >>> capability(10000)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "<stdin>", line 7, in capability
    MemoryError: memory allocation failed, allocating 12354 bytes

    运行环境:MAIXpy-bit, 主频:400MHZ(可超频至600MHZ)FLASH:128Mbit , SRAM:内置8M byte

    运行结果:

    MicroPython v0.5.0-22-g7ac6b09bf-dirty on 2020-03-09; Sipeed_M1 with kendryte-k210
    Type "help()" for more information.
    >>> from machine_capability import*
    >>> capability(100)
    @spend time: 463 us
    >>> capability(1000)
    @spend time: 23896 us
    >>> capability(50000)
    @spend time: 98910354 us
    >>> capability(60000)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "machine_capability.py", line 7, in capability
    MemoryError: memory allocation failed, allocating 91652 bytes

    根据上面性能测试排名:

    1. STM32H743VIT6
    2. MaixPy-bit
    3. ESP32

    参考链接:http://bbs.eeworld.com.cn/thread-490119-1-1.html

  • 相关阅读:
    深刻剖析spring三种注入方式以及使用注解的原理
    springcloud(一):大话Spring Cloud
    springcloud学习资料汇总
    springboot(一):入门篇
    springboot学习资料汇总
    jvm系列(七):如何优化Java GC「译」
    jvm系列(六):Java服务GC参数调优案例
    jvm系列(五):Java GC 分析
    jvm系列(四):jvm调优-命令篇
    android view、viewgroup 事件响应拦截处理机制
  • 原文地址:https://www.cnblogs.com/iBoundary/p/12529752.html
Copyright © 2011-2022 走看看