In Ring 1.27 (GitHub) - Faster WebLib - HTML generation using nested braces (78x faster)

46 views
Skip to first unread message

Mahmoud Fayed

unread,
May 14, 2026, 10:24:07 PMMay 14
to The Ring Programming Language
Hello

Ring 1.27 introduces a major performance improvement to the WebLib library through a new stack-based rendering engine for nested HTML elements. In previous versions, every HTML element created inside a brace block — such as Table, TR, TD, H1, and so on — allocated a separate Ring object in memory. A page with a table of 100 rows and 5 columns would silently create over 500 objects, each carrying hundreds of attributes, output string, and child object list. The overhead of allocating, initializing, and garbage-collecting all these objects was the dominant cost of page generation.

Example:

load "weblib.ring" import system.web func main t1 = clock() cOutput = createReport() t2 = clock() ? "Time: " + (t2-t1) + " ms" write("report.html", cOutput) system("report.html") func createReport nCustCount = 100 oPage = new HtmlPage { h1 { text("Customers Report") } Table { style = styleWidth("100%")+styleGradient(4) TR { TD { WIDTH = "10%" text("Customers Count : ") } TD { text(nCustCount) } } } Table { style = styleWidth("100%")+styleGradient(26) TR { style = styleWidth("100%")+styleGradient(24) TD { text("Name ") } TD { text("Age") } TD { text("Country") } TD { text("Job") } TD { text("Company") } } for t=1 to nCustCount TR { TD { text("Test "+t) } TD { text("30") } TD { text("Egypt") } TD { text("Sales") } TD { text("Future") } } next } } return oPage.output()

Output (Using Ring 1.27):

Time: 9 ms

Output (Using Ring 1.26):

Time: 703 ms
Ring 1.27 completes in 9 ms versus 703 ms in Ring 1.26 — a ~78x faster.

Pages with deeper nesting or more rows benefit proportionally. Existing user code requires no changes; the brace-block syntax, attribute assignment, style functions, and all element names work exactly as before.

Note: If we need better performance, we can generate HTML documents using WebLib functions or HTML Templates.

Greetings,
Mahmoud

Carlos Miguel FARIAS

unread,
May 15, 2026, 11:35:06 AMMay 15
to Mahmoud Fayed, The Ring Programming Language
👍🖖

--

---
You received this message because you are subscribed to the Google Groups "The Ring Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ring-lang+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ring-lang/4c4211f0-ff61-4666-92b4-fbc3947086acn%40googlegroups.com.

Bert Mariani

unread,
May 15, 2026, 11:35:31 AMMay 15
to The Ring Programming Language
Hello Mahmoud

Great HTML example. Simple and easy to understand.
78X Faster !!!
Things are Getting Faster one feature at a time !!

Regards
Bert Mariani

Mahmoud Fayed

unread,
May 15, 2026, 12:45:30 PMMay 15
to The Ring Programming Language
Hello Bert, Carlos

>> "Great HTML example. Simple and easy to understand. 78X Faster !!! Things are Getting Faster one feature at a time !!"

Thanks for your kind words :D

Greetings,
Mahmoud
Reply all
Reply to author
Forward
0 new messages