Files
open-webui/backend/open_webui/utils
Classic298 9db6251498 perf: large chats open about twice as fast (#33665)
Before a chat is stored or returned, the server checks all of its text for null bytes and invalid characters that the database cannot store. That check converted the whole chat to JSON text and scanned it, which on chats with long histories or pasted images took as long as reading the chat from the database, and blocked every other request on that server process meanwhile. The check now inspects each text value in place and skips the slow scan for plain ASCII values such as base64 images. It flags exactly the same chats as before, except that chats containing the six characters \u0000 as ordinary text (common in code) no longer go through a needless cleanup copy on every load.

Measured on SQLite, best of 5 runs, sizes are the stored chat JSON:

| Chat | Check before | Check after | Opening the chat before | Opening the chat after |
| --- | --- | --- | --- | --- |
| 7 MB, text only | 13 ms | 2 ms | 31 ms | 20 ms |
| 49 MB, with images | 107 ms | 4 ms | 211 ms | 108 ms |
| 209 MB, with images | 456 ms | 15 ms | 890 ms | 444 ms |
2026-11-05 06:44:48 +09:00
..
2026-10-30 07:50:55 +09:00
2026-10-01 03:31:20 +04:00
2026-11-03 16:25:23 +09:00
2026-10-14 17:10:08 +04:00
2026-11-02 00:31:46 +09:00
2026-10-26 07:24:36 +09:00
2026-11-02 08:48:51 +09:00
2026-11-02 08:48:51 +09:00
2026-11-02 00:31:46 +09:00
2026-10-12 17:29:04 +04:00
2026-07-23 02:54:56 -04:00
2026-11-02 09:52:30 +09:00
2026-11-03 16:25:23 +09:00
2026-07-31 17:41:14 -04:00
2026-11-02 08:48:51 +09:00
2026-11-03 17:36:03 +09:00
2026-10-25 08:24:14 +09:00
2026-11-03 17:17:59 +09:00
2026-07-26 23:09:22 -04:00
2026-11-02 08:48:51 +09:00
2026-11-02 08:48:51 +09:00
2026-11-02 08:48:51 +09:00
2026-03-17 17:58:01 -05:00
2026-08-24 18:29:36 -04:00
2026-11-02 12:45:15 +09:00
2026-10-16 14:31:39 +04:00
2026-11-02 17:49:51 +09:00
2026-11-02 08:48:51 +09:00
2026-11-02 12:09:54 +09:00
2026-10-10 23:18:09 +04:00
2026-10-14 23:21:22 +04:00
2026-11-02 08:48:51 +09:00
2026-10-11 15:55:57 +04:00
2026-11-02 08:48:51 +09:00