Faster version of the Waving Cubes sample in RingRayLib

45 views
Skip to first unread message

Mahmoud Fayed

unread,
Jun 14, 2024, 2:25:49 PMJun 14
to The Ring Programming Language
Hello

Now we have an updated version of the waving cubes sample (without threads)


Please try it and see the performance results (FPS) on your machine?

Performance on my machine
** Using Ring 1.21 (32bit) ---> 100 FPS  
** Using Ring 1.21 (64bit) ---> 73 FPS

Note: 
The C version of this sample works at 480 FPS
The Python version of this sample (without optimization) works at 84 FPS

Greetings,
Mahmoud


Mansour Ayouni

unread,
Jun 14, 2024, 8:02:35 PMJun 14
to Mahmoud Fayed, The Ring Programming Language
Hello Mahmoud,

What makes Ring faster than Python and C in this regard?

Best,
Mansour

--

---
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 on the web visit https://groups.google.com/d/msgid/ring-lang/5feecc20-c132-4876-88cd-1eef050dc937n%40googlegroups.com.
Message has been deleted

Mahmoud Fayed

unread,
Jun 14, 2024, 8:48:11 PMJun 14
to The Ring Programming Language
Hello Mansour

>> "What makes Ring faster than Python and C in this regard?"

It's faster than Python in this sample (BUT NOT FASTER THAN C)

Since RingRayLib uses RayLib 2.5 while my Python test program uses latest version of RayLib
I tried to use RayLib 5.0 (Latest release) then test again

Ring (waving cubes) ---> 120 FPS
Python (waving cubes) ---> 84 FPS

So back to your question, Why Ring is Faster than Python in This sample (provide extra 36 frames)

We did an optimization to the sample code which cache ColorFromHSV() function output 
Without this optimization Ring & Python will provide similar speed (To be more accurate Python will be slightly faster < 25%)

On the other Hand ---> The threads version of the sample (Since Ring doesn't have GIL)

Ring ---> 230 FPS (with/without caching ColorFromHSV() output)

Greetings,
Mahmoud

Bert Mariani

unread,
Jun 14, 2024, 10:57:05 PMJun 14
to The Ring Programming Language
Hello Mahmoud

Performance on my machine  -- HP Laptop i5 - dy5xxx
   - Using Ring 1.20 (64bit) --->  57 FPS

Much faster than I remember it being !
Great !!

Mansour Ayouni

unread,
Jun 15, 2024, 12:32:54 AMJun 15
to Bert Mariani, The Ring Programming Language
Hello Mahmoud,

Thank you!

Best,
Mansour


Mahmoud Fayed

unread,
Jun 15, 2024, 4:45:18 AMJun 15
to The Ring Programming Language
Hello Mansour

>> "Thank you!"

You are welcome :D

Greetings,
Mahmoud

Mahmoud Fayed

unread,
Jun 15, 2024, 4:48:46 AMJun 15
to The Ring Programming Language
Hello Bert

>> "Using Ring 1.20 (64bit) --->  57 FPS"

This is very nice because Ring 1.20 uses RayLib 2.5
Once we update to RayLib 5.0 ---> This will provide from 30% to 40% performance improvement in this sample
And once we update to Ring 1.21 ---> This will provide 10% performance improvement in this sample

So, you could expect from 70 FPS to 90 FPS in the future (using Ring 1.21 and RayLib 5.0) 

>> "Much faster than I remember it being !
Great !!"

You are welcome :D

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