среда, 2 октября 2019 г.

RAM footprint of Tango RPC on NodeMCU

Hi! It's about time to look at figures: is RPC light or a real burden for MCUs?
Let's see...



HW: ESP8266 in dev.board format.
SW: NodeMCU Lua firmware.
NodeMCU custom build by frightanic.com
    branch: master
    commit: c16adb5dfb8c02b692034bbd553502765b9733cc
    SSL: false
    modules: adc,bit,ds18b20,file,gpio,i2c,net,node,ow,pcm,perf,pwm,rtcfifo,rtcmem,rtctime,spi,tmr,uart,wifi
build created on 2019-07-11 04:00
powered by Lua 5.1.4 on SDK 2.2.1(6ab97e9)

Well, let's look at the baseline:
> =node.heap()
43408

Fine. Let's connect to a Wi-Fi:
> dofile("init_draft.lua")
>
...
Connected to [...] with IP 10.42.0.120
> =node.heap()
41448
🤔 ok.
Let's start Tango server according to the README:
>  =require "tango.server.nodemcu.net".new()
table: 3fff1058
> =node.heap()
26768
sux 😞

Let's test from the PC remotely:
$  TANGO_SERVER=10.42.0.120 lua5.1
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> tango = require'tango'
> config = { address = os.getenv("TANGO_SERVER") }
> connect = tango.client["socket"].connect
> client = connect(config)
> print (client.node.heap())
26400

Summary

Looks like Tango eats 36% of free RAM. That's HUGE.
Yet the situation is definitely optimizable:
  1. Tango is currently just uploaded in Lua src format right into SPIFFS. That's suboptimal. Use lc and LFS.
  2. Another thing comes to mind about Tango library: serialization part (which is pluggable). It can be replaced by something smarter.
PRs welcome 😁

Комментариев нет:

Отправить комментарий