MIAplc
Performance

How fast is a PLC that costs a few euros?

No promises: timings measured on real boards, and from there the maths for two concrete plants, a hotel and an irrigated field. Where a number is an estimate, it says so.

measured0.79 µsone ladder network “contact → coil” on ESP32
measured0.92 ms1000 ladder networks, one full scan
measured5.4×faster on the P4 with machine code, on a large program
measured0.3–0.5 msround trip of a µLink I/O module
The virtual machine

How long it takes, function by function

The ladder program becomes bytecode, which the VM runs every scan. The P4 is a more powerful processor and can also turn the simple parts into machine code, which the CPU runs directly. Lower times = faster.

FunctionESP32-WROOMESP32-P4
One contact → coil network0.79 µs≈ 0.4–0.5 µs
One network with an addition (ADD)1.4 µs≈ 0.7–0.9 µs
Simple machine, ~300 instructions0.25 ms≈ 0.15 ms
1000 contact → coil networks0.92 ms≈ 0.5 ms
Program with 101 functions (14.8 KB)1.44 ms WiFi off only≈ 0.7–1 ms
Large plant: 129 blocks, 4.3 MBdoesn't fit38.9 ms with machine code
209.7 ms with the VM only

Values without “≈”: measured on the board. With “≈”: estimated, the P4 1.5 to 2.2 times the ESP32 with the same VM. Machine code pays off on large programs; on a small program full of loops and jumps it's slower than the VM (168 µs vs 136 µs, measured): that's why on the P4 it's a choice, not a must.

Program size

How much program fits

All memory and space values on this page are those of the PLC board: the program, DBs and data live there. I/O modules don't hold the program and the PC is only used to write it. Work memory is the board's RAM where the bytecode runs; on the ESP32 it shares it with the network, and WiFi alone takes a lot.

ESP32 PLC board

  • work memory, WiFi + Ethernet11.4 KB
  • work memory, Ethernet only~50 KB
  • DB area8 KB
  • load memory (flash)256 KB

In practice: 11 KB is about 1000 simple ladder networks, already a real plant. 50 KB holds a 100-function program.

ESP32-P4 PLC board

  • work memory (with PSRAM)~7.6 MB
  • program code, at most8 MB
  • DB area2 MB

How big is 4 MB? A simple network takes about ten bytes; one from a real plant, with comparisons and boxes, 30–60 bytes. An automatic machine has a few hundred networks; a complete production line a few thousand. The test's 4.3 MB correspond to tens of thousands of networks: the size of a whole department, not of one machine. For a hand-written program the P4's memory never runs out: the limit becomes inputs and outputs.

Communication

One PLC and three I/O modules

A real test: an ESP32-P4 PLC and three ESP32 modules on µLink, with the editor Online and a Download running to stress it. Every round the PLC sends each module the state of all its outputs and gets back all its inputs.

Average round trip measured for each module, exchange every 5 ms, with the editor Online and a Download running.

measured0.31–0.50 msaverage round trip, per module
measured200 per secondexchanges per module: 64 outputs and 64 inputs each time
measured22,608exchanges per module during the test, all valid
measured< 0.5 %replies arriving late, under stress

A lost frame does no harm: every frame carries the full state, and the next round puts everything right. The worst point measured, during a heavy Download, was 12–15 ms.

In practice · 1

The hotel: how many rooms?

Each room: 10 buttons, 10 lights, climate with temperature probe, valve and fan. A “Room” function written once and called for every room; one 64-I/O µLink module in the floor cabinet serves 5 rooms.

ESP32

ESP32-P4

A blink lasts 100–400 ms: under 100 ms from button to light no guest notices anything. The P4 in its extended configuration (in development) reaches 1000 I/O boards, 128 kbit of I/O and a 128k-value REAL area: that's the top of the slider. Keeping lights under 100 ms, about 1300 rooms fit; beyond that, split over more buses or PLCs.

In practice · 2

Irrigation: how many hectares before RAM runs out?

Each hectare: 2 sectors with valve, watering time and soil-moisture threshold, plus one probe. Plus a fixed station: pumps, pressure, dosers, sludge treatment, mixers, chemical probes.

ESP32

ESP32-P4

A field is in no hurry: even a half-second scan is fine. Here the real limits are memory and I/O points, not speed. On the P4 probes are not a problem: the 128k-value REAL area is enough for over 100,000 probes, so the ceiling stays the DB area. Analog probes need modules with analog inputs or Modbus sensors.

In practice · 3

Baggage conveyors

Each conveyor: 4 photocells, motor, bag tracking (where every item is), jams and diverters. Here speed matters: at 2 m/s a bag travels 4 cm in 20 ms, so we want every conveyor refreshed at least every 20 ms. One 64-I/O µLink module serves 15 conveyors.

ESP32

ESP32-P4

A large airport doesn't use one PLC: the system is split into zones, each with its own PLC. An ESP32 handles a small zone, a P4 a zone of hundreds of conveyors, over 2000 with machine code. Estimates: a real baggage system must be engineered and tested on site.

Summary

One row per board

BoardHotel today (8 modules)Hotel at the limitIrrigation: hectares before RAM runs outBaggage conveyors, refreshed every 20 ms

“At the limit”: ESP32 with 15 modules (all the program's I/O); P4 in its extended configuration, in development: 1000 I/O boards, 128 kbit of I/O, 128k REAL. The time is how often all rooms are refreshed.

🤓 For the curious: raw numbers and how we did the maths

Measurements (real boards, firmware 0.3.39–0.3.71, November 2026)

WhatValueWhere
LD → ST network (3 VM instructions)788 nsESP32-WROOM 240 MHz
Network with ADD DINT on DB1,364–1,460 nsESP32
Empty scan (I/O, system DB, checks)~0.13 msESP32
carico-100fc: Main + 101 FCs, 14.8 KB1.44 msESP32
4.3 MB of machine code, 129 blocks: VM / mixed209.7 / 38.9 msESP32-P4, 60 comparisons with the interpreter identical
Small program with loops: VM / machine code136 / 168 µsESP32-P4
Free work memory, WiFi + Ethernet11,702 bytesESP32
Free work memory7,989,150 bytesESP32-P4 with PSRAM
µLink, average round trip (3 ESP32 modules)309–495 µsP4 PLC, 5 ms period
µLink, late replies under stress0.06–0.42 %22,608 exchanges per module
µLink, ESP32-C3 + W5100 (SPI) module4.7–7.3 msthe SPI chip is the bottleneck
µLink, 8 modules~1.3 ms of bus every 5 msµLink documentation
µLink, 192 modules (test)16 ms to send everythingESP32-P4
Download of 127 KB over USB (serial cable, including STOP and flash write)~28 sESP32-P4, MiaConfig automatic measurement
Editor over Ethernet / USB0.7–1.3 s / 33.5 s370 KB, 18 files
Status request over Ethernet, PLC in RUN31–40 msESP32 and P4

Estimates (to be confirmed)

  • P4 with the interpreter VM: at least 1.5× the ESP32 (RISC-V CPU at 360–400 MHz; the estimate ranges 1.5–2.2×). We use 1.5× in the maths.
  • FC call: ~0.3 µs, plus ~0.25 µs per parameter.
  • Room: 23 bit networks, 3 boxes (climate scaling and comparisons), 26 parameters → ~29 µs on ESP32, ~19 µs on P4; 107 bytes of call + 24 bytes of DB; the “Room” FC 600 bytes, once. 12 outputs per room: 5 rooms per module with 63 usable outputs.
  • Hectare: 2 sectors × (5 networks, 4 boxes including the timer, 12 parameters) → ~26 µs on ESP32; 102 bytes of calls, 56 bytes of DB (two 16-byte TIMERs, times, thresholds, probe). Fixed station: 4 KB of code, 1 KB of DB, 0.4 ms.
  • Conveyor: 20 bit networks, 10 boxes (tracking, timers, comparisons), 15 parameters → ~34 µs on ESP32, ~23 µs on P4 with the VM; with the P4's machine code 5.4× faster (the value measured on the large program). 63 bytes of call, 64 bytes of DB (bag queue, timers); 4 inputs per conveyor: 15 conveyors per module. Target: everything refreshed within 20 ms.
  • Bus: period = at least 5 ms, with the bus busy at most 60 %; on the P4 0.083 ms per module (192 modules in 16 ms). Worst-case reaction = 2 periods + 1 scan.
  • P4 extended configuration (in development): 1000 I/O boards, 128-kbit I/O areas, a REAL area of 131,072 values (128k). One REAL probe per room and per hectare.

The formulas

scan    = 0.13 ms + N × (networks × 0.79 + boxes × 1.4 + 0.3 + params × 0.25) µs ÷ speed
memory  = fixed code + N × call bytes          ≤ work memory
data    = fixed data + N × DB bytes            ≤ DB area
period  = max(5 ms, modules × time per module ÷ 0.6)

The calculator is in the site file assets/js/prestazioni.js: all starting numbers are at the top, with their source.