Skip to content

Commit e95c2fb

Browse files
committed
feat: add high perf mode documentation
1 parent b7e53c9 commit e95c2fb

File tree

4 files changed

+45
-4
lines changed

4 files changed

+45
-4
lines changed

src/content/features/custom-title.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import ProCallout from '@/src/components/ProCallout';
99

1010
<br/>
1111
<ProCallout />
12+
<br/>
1213

1314
<img src="/assets/images/v2/custom-title.png" alt="Custom Title" width="400px" />
1415

src/content/features/printing.mdx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ Here are a example few methods which can be used to print logs/messages to WebSe
2525

2626
Prints data to the WebSerial port as human-readable ASCII text.
2727

28-
<Callout emoji="💡">
29-
**Tip**: If your application is dependent on `print` statements a lot, then please consider using `HighPerf` mode to avoid performance bottlenecks.
30-
</Callout>
31-
3228
```cpp
3329
WebSerial.print(data);
3430
```

src/content/getting-started/_meta.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ const metadata = {
88
"examples": {
99
"title": "Examples"
1010
},
11+
"high-performance": {
12+
"title": "High Performance Mode"
13+
}
1114
}
1215

1316
export default metadata
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: High Performance Mode
3+
description: "Learn how to enable High Performance Mode in WebSerial to optimize data transmission and improve the performance of your IoT devices. This guide covers setup, usage, best practices, and use cases for the high performance feature."
4+
---
5+
6+
import { Tabs } from 'nextra/components'
7+
8+
# High Performance Mode
9+
10+
WebSerial comes with an inbuilt High Performance Mode that optimizes data transmission for performance-critical applications. This mode should only be used when you require real-time logging and monitoring, as it minimizes latency and maximizes throughput by avoiding any kind of buffering for log messages.
11+
12+
> [!NOTE]
13+
>
14+
> High Performance Mode should only be enabled when necessary, for example when your application is heavily dependent on large logs. Using this mode in scenarios where real-time logging is not required may lead to instability or performance degradation.
15+
16+
17+
<Tabs items={['Arduino IDE', 'PlatformIO']}>
18+
<Tabs.Tab>
19+
To enable High Performance Mode in Arduino IDE, follow these steps:
20+
21+
1. Open the `WebSerial.h` file located in your Arduino libraries folder.
22+
2. At the top of the file, just after the `#include` statements, add the following line:
23+
```cpp
24+
#define WSL_HIGH_PERF 1
25+
```
26+
3. Save the file and restart your Arduino IDE to apply the changes.
27+
</Tabs.Tab>
28+
<Tabs.Tab>
29+
You can easily enable High Perf mode by setting the build flag in your `platformio.ini` file.
30+
1. Open the `platformio.ini` file of your project.
31+
2. Add the following line under the `[env:<your_environment>]` section:
32+
```ini
33+
build_flags = -DWSL_HIGH_PERF=1
34+
```
35+
3. Save the changes to the `platformio.ini` file.
36+
4. With PlatformIO, you can also further optimize AsyncWebServer *(used by WebSerial)* for high performance by adding the following additional build flags:
37+
```ini
38+
-DCONFIG_ASYNC_TCP_QUEUE_SIZE=128 -D CONFIG_ASYNC_TCP_RUNNING_CORE=1 -DWS_MAX_QUEUED_MESSAGES=128
39+
```
40+
</Tabs.Tab>
41+
</Tabs>

0 commit comments

Comments
 (0)