In Ring 1.27 (GitHub) - Calling methods using the dot operator is now 5x faster

52 views
Skip to first unread message

Mahmoud Fayed

unread,
Apr 22, 2026, 9:06:29 AM (2 days ago) Apr 22
to The Ring Programming Language
Hello

In this post we share good news about performance improvements in Ring 1.27 

Results:
ringperformance.png

The goal behind these improvements is to encourage developing more Ring libraries that uses OOP, Natural Language Programming, The Natural Library, etc. So, when we develop new domain-specific languages (DSLs) using the Natural Library, we get higher abstraction with acceptable performance.

This direction of development (DSLs that uses natural commands) is very attractive in the AI age, because using AI models to generate code in these DSLs means
(1) Generating Readable & Natural Code (Easy to revise/understand/modify)
(2) Higher Abstraction Level = Less Tokens  

Greetings,
Mahmoud 

Bert Mariani

unread,
Apr 22, 2026, 9:23:06 AM (2 days ago) Apr 22
to The Ring Programming Language
Hello Mahmoud

This is quite impressive !!
Calling Ring methods via the Dot operator - 5X 
Especially impressive !!

Regards
Bert Mariani

The Future of Programming

unread,
Apr 22, 2026, 11:10:39 AM (2 days ago) Apr 22
to The Ring Programming Language
Hello Bert

You are welcome :D

Greetings, 
Mahmoud

--

---
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/09d7deb8-9366-402f-9138-1fd3823a1192n%40googlegroups.com.

Mansour Ayouni

unread,
Apr 22, 2026, 11:16:54 AM (2 days ago) Apr 22
to The Future of Programming, The Ring Programming Language
Hello Mahmoud,

Thank you for letting Ring be better at this front.

For the sake if discovery, I am wandering what you made to get this performance gain in calling objets methods...

All the best 


Mahmoud Fayed

unread,
Apr 22, 2026, 2:15:51 PM (2 days ago) Apr 22
to The Ring Programming Language
Hello Mansour

>> "Thank you for letting Ring be better at this front."

You are welcome :D

>> "For the sake if discovery, I am wandering what you made to get this performance gain in calling objets methods..."

In general, there are common & known ideas to improve the performance like 
(1) Avoiding unnecessary instructions.
(2) Caching results
(3) Reducing abstractions
(4) Reducing memory
(5) Using arrays instead of linked lists 
(6) Replacing VM instructions with optimized instructions that uses cached results
(7) Using VM instruction that does multiple things (Super Instructions)

When we use object.method()
At first, Ring VM access the object through multiple steps 
* Access a List the represent the Ring variable and exist in a specific scope
* Access a List that represent the object (Class pointer, Object Data)
* Use the class pointer to get the class methods (taking inheritance in mind)
* Search in the methods for the method that we want using HashTable 
* Get the (this) variable list from internal global scope and update it according to the current object
* Call the method
* These operations are multiple VM instructions that are executed by the bytecode execution loop

So, we did the next optimizations
(1) Defining a new preprocessor that access the variable list directly (without using functions that check the list size, item type, etc.) - Then using this preprocessor in each place in Ring VM source code that access a variable list
(2) Defining a new preprocessor that access the object list direction (without using functions that check the list size, item type, etc.) - Then using this preprocessor in each place in Ring VM source code that access the object list
(3) When finding a method, cache the result in the current byte code instruction and change the instruction operation code to another one that uses the cache (if it's valid) directly
(4) Instead of searching for the (this) variable list - cache it in the VM structure
(5) Replace the switch statement in bytecode execution loop with computed goto
(6) When calling a method, we used to store the current object data in a Ring list pObjState - and we used to add/delete sub lists to this list when we use objects. We changed this behavior to use pre-allocated array and just increment/decrement a counter 

Greetings,
Mahmoud

Youssef Saeed

unread,
Apr 22, 2026, 7:56:06 PM (2 days ago) Apr 22
to The Ring Programming Language
Hello Mahmoud,

Thank you for these impressive improvements! A 5x speedup for OOP method dispatch is a massive achievement. This will be a game-changer for building efficient DSLs and improving AI integration.

Best regards,
Youssef

Mahmoud Fayed

unread,
Apr 22, 2026, 8:30:01 PM (2 days ago) Apr 22
to The Ring Programming Language
Hello Youssef

You are welcome :D

Greetings,
Mahmoud

Reply all
Reply to author
Forward
0 new messages