Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8

Merged
merged 13 commits into from
Oct 2, 2022

Conversation

salasidis
Copy link
Contributor

Do not update src files, as they do not include khoih changes already made

@khoih-prog
Copy link
Owner

khoih-prog commented Oct 2, 2022

Can you also update the src files to your repo, then make the PR again to reduce the number of PRs?

@khoih-prog
Copy link
Owner

Also merge to the RSMOD branch first to test. Then will merge to the main branch after everything is OK.

@salasidis
Copy link
Contributor Author

Don't know how to resolve the conflicts - it says has conflicts, and use command line to resolve. I need to merge your changes first, and then will d a new pull request, and the example files should be the only thing different

@khoih-prog
Copy link
Owner

It's very good now. I'll scan thru and merge soon.

@salasidis
Copy link
Contributor Author

I guess I don't have to confirm a pull request - I thought I hadn't completed it.

Thanks for the walkthrough - I was missing having to download the files locally, and then upload them into my repository. There were actually no conflicts after doing that.

@khoih-prog
Copy link
Owner

The new examples somehow don't auto-refresh the graph. Can you check why with the new code ?

@salasidis
Copy link
Contributor Author

I specifically eliminated the auto refresh, by removing the meta tag on the web html. Just to make the output cleaner - single pass. Can manually refresh if required.

@khoih-prog
Copy link
Owner

To demo the larger graph, also change the examples to

  strcat(cStr, "<svg xmlns=\"http:https://www.w3.org/2000/svg\" version=\"1.1\" width=\"1810\" height=\"150\">\n");
  strcat(cStr, "<rect width=\"1810\" height=\"150\" fill=\"rgb(250, 230, 210)\" stroke-width=\"2\" stroke=\"rgb(0, 0, 0)\" />\n");

from

  strcat(cStr, "<svg xmlns=\"http:https://www.w3.org/2000/svg\" version=\"1.1\" width=\"310\" height=\"150\">\n");
  strcat(cStr, "<rect width=\"310\" height=\"150\" fill=\"rgb(250, 230, 210)\" stroke-width=\"2\" stroke=\"rgb(0, 0, 0)\" />\n");

Selection_096

@khoih-prog
Copy link
Owner

OK, I still prefer put it back to demo the HEAP is still very good after many times running

<meta http-equiv='refresh' content='5'/>\

@khoih-prog
Copy link
Owner

So far so good. Everybody will love your new powerful enhancement.

Will certainly spread to many other Async libraries, at least mine.

@khoih-prog khoih-prog merged commit 1ef95e5 into khoih-prog:main Oct 2, 2022
@khoih-prog
Copy link
Owner

Merging now. Will create a new version soon after some minor changes and enhancements (favicon example, etc.)

If you have time, please create similar powerful PRs for many other AsyncWebserver libraries of mine.

Best Regards,

@khoih-prog khoih-prog changed the title Added example files request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap Oct 2, 2022
@salasidis
Copy link
Contributor Author

I unfortunately have no other boards to run or test on, but if I need to use another lower cost board, I will be sure to port this to it as well (presumably the source is very similar between all of them).

One important thing to note however, without the memory mapped SDRAM, other boards would only get half the benefit, as the initial string will have to reside in the regular heap space. So in the second example (with the C string), I think the heap required would be in the order of 50k-60k instead of 12k (but still better than 111k)

@khoih-prog
Copy link
Owner

One important thing to note however, without the memory mapped SDRAM, other boards would only get half the benefit, as the initial string will have to reside in the regular heap space. So in the second example (with the C string), I think the heap required would be in the order of 50k-60k instead of 12k (but still better than 111k)

Certainly, everybody must know this, at least not 2x or 3x like before

I unfortunately have no other boards to run or test on, but if I need to use another lower cost board, I will be sure to port this to it as well (presumably the source is very similar between all of them).

You can start with very cheap boards, such as (according to priority : power, cost, popularity, availability, etc.)

@khoih-prog
Copy link
Owner

khoih-prog commented Oct 2, 2022

So far so good

image


Async_AdvancedWebServer_MemoryIssues_Send_CString ===> Using SDRAM, very small heap (12847).

Start Async_AdvancedWebServer_MemoryIssues_Send_CString on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
Portenta_H7_AsyncTCP v1.4.0
Portenta_H7_AsyncWebServer v1.3.0
Using mac index = 18
Connected! IP address: 192.168.2.123
HTTP EthernetWebServer is @ IP : 192.168.2.123
HEAP DATA - Pre Create Arduino String  Cur heap: 8458  Res Size: 451680  Max heap: 8472
.HEAP DATA - Pre Send  Cur heap: 9634  Res Size: 451680  Max heap: 10196
Out String Length=31259
HEAP DATA - Post Send  Cur heap: 9734  Res Size: 451680  Max heap: 12847
HEAP DATA - Pre Send  Cur heap: 9634  Res Size: 451680  Max heap: 12847
Out String Length=31279
HEAP DATA - Post Send  Cur heap: 9734  Res Size: 451680  Max heap: 12847
.HEAP DATA - Pre Send  Cur heap: 9634  Res Size: 451680  Max heap: 12847
Out String Length=31231
HEAP DATA - Post Send  Cur heap: 9734  Res Size: 451680  Max heap: 12847
.HEAP DATA - Pre Send  Cur heap: 9634  Res Size: 451680  Max heap: 12847
Out String Length=31239
HEAP DATA - Post Send  Cur heap: 9734  Res Size: 451680  Max heap: 12847
HEAP DATA - Pre Send  Cur heap: 9634  Res Size: 451680  Max heap: 12847
Out String Length=31259
HEAP DATA - Post Send  Cur heap: 9734  Res Size: 451680  Max heap: 12847
.HEAP DATA - Pre Send  Cur heap: 9634  Res Size: 451680  Max heap: 12847
Out String Length=31249
HEAP DATA - Post Send  Cur heap: 9734  Res Size: 451680  Max heap: 12847
HEAP DATA - Pre Send  Cur heap: 9634  Res Size: 451680  Max heap: 12847
Out String Length=31200
HEAP DATA - Post Send  Cur heap: 9734  Res Size: 451680  Max heap: 12847
.

Async_AdvancedWebServer_MemoryIssues_SendArduinoString ===> very large heap (111387)

Start Async_AdvancedWebServer_MemoryIssues_SendArduinoString on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
Portenta_H7_AsyncTCP v1.4.0
Portenta_H7_AsyncWebServer v1.3.0
Using mac index = 15
Connected! IP address: 192.168.2.123
HTTP EthernetWebServer is @ IP : 192.168.2.123
HEAP DATA - Pre Create Arduino String  Cur heap: 7434  Res Size: 452048  Max heap: 7448
.HEAP DATA - Pre Send  Cur heap: 48611  Res Size: 452048  Max heap: 48611
Out String Length=31259
HEAP DATA - Post Send  Cur heap: 79009  Res Size: 452048  Max heap: 111347
.HEAP DATA - Pre Send  Cur heap: 48611  Res Size: 452048  Max heap: 111347
Out String Length=31279
HEAP DATA - Post Send  Cur heap: 79029  Res Size: 452048  Max heap: 111387
HEAP DATA - Pre Send  Cur heap: 48611  Res Size: 452048  Max heap: 111387
Out String Length=31231
HEAP DATA - Post Send  Cur heap: 78981  Res Size: 452048  Max heap: 111387
.HEAP DATA - Pre Send  Cur heap: 48611  Res Size: 452048  Max heap: 111387
Out String Length=31239
HEAP DATA - Post Send  Cur heap: 78989  Res Size: 452048  Max heap: 111387
HEAP DATA - Pre Send  Cur heap: 48611  Res Size: 452048  Max heap: 111387
Out String Length=31259
HEAP DATA - Post Send  Cur heap: 79009  Res Size: 452048  Max heap: 111387
.HEAP DATA - Pre Send  Cur heap: 48611  Res Size: 452048  Max heap: 111387
Out String Length=31249
HEAP DATA - Post Send  Cur heap: 78999  Res Size: 452048  Max heap: 111387

khoih-prog added a commit that referenced this pull request Oct 3, 2022
### Releases v1.4.0

1. Support using `CString` in optional `SDRAM` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](#8)
2. Add multiple examples to demo the new feature
@khoih-prog
Copy link
Owner

Hi @salasidis

The new Portenta_H7_AsyncWebServer v1.4.0 has just been published. Your contribution is noted in Contributions and Thanks

Also check Important Note from v1.4.0


Releases v1.4.0

  1. Support using CString in optional SDRAM to save heap to send very large data. Check request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8
  2. Add multiple examples to demo the new feature

Selection_099

khoih-prog added a commit that referenced this pull request Oct 3, 2022
### Releases v1.4.0

1. Support using `CString` in optional `SDRAM` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](#8)
2. Add multiple examples to demo the new feature
khoih-prog added a commit to khoih-prog/AsyncWebServer_RP2040W that referenced this pull request Oct 3, 2022
### Release v1.2.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8)
2. Add multiple examples to demo the new feature
khoih-prog added a commit to khoih-prog/AsyncWebServer_RP2040W that referenced this pull request Oct 3, 2022
### Release v1.2.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8)
2. Add multiple examples to demo the new feature
khoih-prog added a commit to khoih-prog/AsyncWebServer_RP2040W that referenced this pull request Oct 3, 2022
### Release v1.2.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8)
2. Add multiple examples to demo the new feature
khoih-prog added a commit to khoih-prog/AsyncWebServer_RP2040W that referenced this pull request Oct 3, 2022
### Release v1.2.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8)
2. Add multiple examples to demo the new feature
khoih-prog added a commit to khoih-prog/AsyncWebServer_WT32_ETH01 that referenced this pull request Oct 4, 2022
#### Releases v1.6.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8)
2. Add multiple examples to demo the new feature
khoih-prog added a commit to khoih-prog/AsyncWebServer_WT32_ETH01 that referenced this pull request Oct 4, 2022
#### Releases v1.6.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8)
2. Add multiple examples to demo the new feature
khoih-prog added a commit to khoih-prog/AsyncWebServer_WT32_ETH01 that referenced this pull request Oct 4, 2022
#### Releases v1.6.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8)
2. Add multiple examples to demo the new feature
khoih-prog added a commit to khoih-prog/AsyncWebServer_Ethernet that referenced this pull request Oct 6, 2022
#### Releases v1.5.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8) and [All memmove() removed - string no longer destroyed #11](khoih-prog/Portenta_H7_AsyncWebServer#11)
2. Add multiple examples to demo the new feature
khoih-prog added a commit to khoih-prog/AsyncWebServer_Ethernet that referenced this pull request Oct 6, 2022
#### Releases v1.5.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8) and [All memmove() removed - string no longer destroyed #11](khoih-prog/Portenta_H7_AsyncWebServer#11)
2. Add multiple examples to demo the new feature
khoih-prog added a commit to khoih-prog/AsyncWebServer_Ethernet that referenced this pull request Oct 6, 2022
#### Releases v1.5.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8) and [All memmove() removed - string no longer destroyed #11](khoih-prog/Portenta_H7_AsyncWebServer#11)
2. Add multiple examples to demo the new feature
khoih-prog added a commit to khoih-prog/AsyncWebServer_Ethernet that referenced this pull request Oct 6, 2022
#### Releases v1.5.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8) and [All memmove() removed - string no longer destroyed #11](khoih-prog/Portenta_H7_AsyncWebServer#11)
2. Add multiple examples to demo the new feature
khoih-prog added a commit to khoih-prog/AsyncWebServer_Ethernet that referenced this pull request Oct 6, 2022
#### Releases v1.5.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8) and [All memmove() removed - string no longer destroyed #11](khoih-prog/Portenta_H7_AsyncWebServer#11)
2. Add multiple examples to demo the new feature
khoih-prog added a commit to khoih-prog/AsyncWebServer_Teensy41 that referenced this pull request Oct 6, 2022
### Releases v1.6.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8) and [All memmove() removed - string no longer destroyed #11](khoih-prog/Portenta_H7_AsyncWebServer#11)
2. Add multiple examples to demo the new feature
khoih-prog added a commit to khoih-prog/AsyncWebServer_Teensy41 that referenced this pull request Oct 6, 2022
### Releases v1.6.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8) and [All memmove() removed - string no longer destroyed #11](khoih-prog/Portenta_H7_AsyncWebServer#11)
2. Add multiple examples to demo the new feature
khoih-prog added a commit to khoih-prog/AsyncWebServer_Teensy41 that referenced this pull request Oct 6, 2022
### Releases v1.6.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8) and [All memmove() removed - string no longer destroyed #11](khoih-prog/Portenta_H7_AsyncWebServer#11)
2. Add multiple examples to demo the new feature
khoih-prog added a commit to khoih-prog/AsyncWebServer_Teensy41 that referenced this pull request Oct 6, 2022
### Releases v1.6.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8) and [All memmove() removed - string no longer destroyed #11](khoih-prog/Portenta_H7_AsyncWebServer#11)
2. Add multiple examples to demo the new feature
khoih-prog added a commit to khoih-prog/AsyncWebServer_Teensy41 that referenced this pull request Oct 6, 2022
### Releases v1.6.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8) and [All memmove() removed - string no longer destroyed #11](khoih-prog/Portenta_H7_AsyncWebServer#11)
2. Add multiple examples to demo the new feature
khoih-prog added a commit to khoih-prog/AsyncWebServer_STM32 that referenced this pull request Oct 6, 2022
### Releases v1.6.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8)
2. Add functions and example `Async_AdvancedWebServer_favicon` to support `favicon.ico`
3. Add multiple examples to demo the new feature
4. Fix issue with slow browsers or network
5. Change license from `MIT` to `GPLv3` to match with original [ESPAsyncWebServer](https://github.com/me-no-dev/ESPAsyncWebServer) license
khoih-prog added a commit to khoih-prog/AsyncWebServer_STM32 that referenced this pull request Oct 6, 2022
### Releases v1.6.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8)
2. Add functions and example `Async_AdvancedWebServer_favicon` to support `favicon.ico`
3. Add multiple examples to demo the new feature
4. Fix issue with slow browsers or network
5. Change license from `MIT` to `GPLv3` to match with original [ESPAsyncWebServer](https://github.com/me-no-dev/ESPAsyncWebServer) license
khoih-prog added a commit to khoih-prog/AsyncWebServer_STM32 that referenced this pull request Oct 6, 2022
### Releases v1.6.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8)
2. Add functions and example `Async_AdvancedWebServer_favicon` to support `favicon.ico`
3. Add multiple examples to demo the new feature
4. Fix issue with slow browsers or network
5. Change license from `MIT` to `GPLv3` to match with original [ESPAsyncWebServer](https://github.com/me-no-dev/ESPAsyncWebServer) license
khoih-prog added a commit to khoih-prog/AsyncWebServer_STM32 that referenced this pull request Oct 6, 2022
### Releases v1.6.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8)
2. Add functions and example `Async_AdvancedWebServer_favicon` to support `favicon.ico`
3. Add multiple examples to demo the new feature
4. Fix issue with slow browsers or network
5. Change license from `MIT` to `GPLv3` to match with original [ESPAsyncWebServer](https://github.com/me-no-dev/ESPAsyncWebServer) license
khoih-prog added a commit to khoih-prog/AsyncWebServer_STM32 that referenced this pull request Oct 6, 2022
### Releases v1.6.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8)
2. Add functions and example `Async_AdvancedWebServer_favicon` to support `favicon.ico`
3. Add multiple examples to demo the new feature
4. Fix issue with slow browsers or network
5. Change license from `MIT` to `GPLv3` to match with original [ESPAsyncWebServer](https://github.com/me-no-dev/ESPAsyncWebServer) license
khoih-prog added a commit to khoih-prog/AsyncWebServer_STM32 that referenced this pull request Oct 6, 2022
### Releases v1.6.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8)
2. Add functions and example `Async_AdvancedWebServer_favicon` to support `favicon.ico`
3. Add multiple examples to demo the new feature
4. Fix issue with slow browsers or network
5. Change license from `MIT` to `GPLv3` to match with original [ESPAsyncWebServer](https://github.com/me-no-dev/ESPAsyncWebServer) license
khoih-prog added a commit to khoih-prog/AsyncWebServer_STM32 that referenced this pull request Oct 6, 2022
### Releases v1.6.0

1. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](khoih-prog/Portenta_H7_AsyncWebServer#8)
2. Add functions and example `Async_AdvancedWebServer_favicon` to support `favicon.ico`
3. Add multiple examples to demo the new feature
4. Fix issue with slow browsers or network
5. Change license from `MIT` to `GPLv3` to match with original [ESPAsyncWebServer](https://github.com/me-no-dev/ESPAsyncWebServer) license
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants