0% found this document useful (0 votes)
10 views20 pages

Programming Languages Choices For Openwrt

Uploaded by

Yasir Shokry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views20 pages

Programming Languages Choices For Openwrt

Uploaded by

Yasir Shokry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Lisbon, OpenWrt Summit 2018

Programming languages:
Choices for OpenWrt
Mislav Novaković

October 30, 2018


Motivation
◦ What is the best language for prototyping in OpenWrt?
◦ Finding the optimal solution between:
• Constraints of embedded devices
• Speed of development
◦ Where to start?
◦ Code samples used from Rosetta
Build setup

◦ OpenWrt feed:
• [Link]/sartura/languages_feed
◦ Docker le:
• [Link]/sartura/languages_feed_docker le
C/C++

◦ Imperative (OO), low-level language


◦ Integrated with OpenWrt and Linux kernel
◦ C++ support
◦ Cross-platform support
SWIG

◦ High-level wrapper for C/C++ ([Link])


◦ Python, Lua, Go, Perl, PHP and Ruby
◦ Better results with C++
◦ Sysrepo OpenWrt package
Python

◦ Imperative, procedural, OO language


◦ Python 2 & 3
◦ 250+ packages
◦ Good C integration
Lua

◦ Lightweight embedded language


◦ Lua 5.1
◦ 40+ packages
◦ UCI and LuCI
◦ Good C integration
GoLang

◦ Compiled, statically typed language (C-like)


◦ Go 1.10.3
◦ 5+ packages
◦ MIPS not fully supported
◦ Large binary size
Rust

◦ System, imperative, procedural language


◦ Cross-compiled
◦ MIPS not fully supported
◦ Good default binary size
Nim

◦ Imperative, compiled language


◦ Cross-compiled
◦ Compiles to C/C++, Objective-C or JavaScript
◦ Good default binary size
[Link]

◦ JavaScript run time environment


◦ [Link] 8.11.3
◦ 10+ packages
Perl

◦ Interpreted, dynamic language


◦ Perl 5
◦ 200+ packages
PHP

◦ Server-side scripting language


◦ PHP 7
◦ 50+ packages
Ruby

◦ Dynamic, interpreted, OO language


◦ Ruby 2.5
◦ 50+ packages
Used boards

◦ Raspberry Pi 3
◦ ClearFog Base
◦ ARM + musl (cross-compiling)
◦ Built & tested on beginning of October 2018
Binary sizes
Language Binary size

C 4.2 Kb

C++ 4.2 Kb

Nim 64.1 Kb

Rust 484.3 Kb

Go 3432.5 Kb
Library sizes
◦ Size of additional libraries used for scripting languages (rough measurements)

Language Library size

Python 17152 Kb

[Link] 12476 Kb

Ruby 4808 Kb

PHP 3380 Kb

Perl 2824 Kb

Lua 364 Kb
Performance
$ httperf –port=80XX –-server IP --num-conns=10000

Language Result

Perl 1326.6 req/s

C++ 1320.8 req/s

C 1299.1 req/s

Nim 1052.1 req/s


PHP 765.8 req/s

Go 763.0 req/s

Rust 586.5 req/s

[Link] 472.2 req/s

Lua 455.5 req/s

Ruby 132.3 req/s

Python 102.4 req/s


Programming languages:
Choices for OpenWrt

[Link]@[Link] · info@[Link] · [Link]

You might also like