Machine Learning in XOJO

Here is a closed topic on machine learning in XOJO from a few years ago:

I decided to make a video comparing the native speed of XOJO and C++ with a machine learning algorithm. Here is the link:
https://youtu.be/na4lY2B7uco

And here is the link to the project files. Happy Coding!

6 Likes

Seems like you did quite a bit of research there. The only thing I would say is that I’ve seen Java smoke Xojo in many performance tests. So I’m not sure that I’d believe Xojo is faster than Java.

The other thing I would recommend researching is multi-core processing. Many languages support pre-emptive threading, allowing you to shift the task to a vacant P core, giving a performance boost, without splitting the task and running on multiple core at once.

I myself have started to favor E cores for many tasks as these help reduce the energy usage of my apps.

2 Likes

Interesting comparison Alexander. Thank you for sharing.

1 Like

Out of curiosity, which version of Xojo did you use in the video? The most recent 2023R4 with performance optimizations or an older one? And which compile optimization level did you use in the tests?

video shows 2023 R3.1 so if he runs on Xojo 2023 R4 he it could have been faster, also he coud use some pragmas to improve some speed.

Scherm­afbeelding 2024-01-08 om 11.01.27

In a build (arm-64 macos, optimization agressive and some pragmas added) i get this speed 1.145

2 Likes

winedata.txt in a build, gives me in macos arm-64 console (with aggressive and pragmas):

My not very fast MacBook Air M1 had 2.8 secs as result. Desktop and not Console.

What can I do with the neural net besides using it for speed testing?

use it for machine learning ?
@Alexander_Kostyak

MacBook Pro M1, 16 GB, from left to right:

– Unmodified code in debugger.
– Unmodified code build, aggressive
– Unmodified code build, aggressive, with pragmas in Run Action handler
– Build, aggressive, with pragmas in each method.
I had not seen build was set to Intel. Last result with ARM:
ELAPSED 0.9163871

which txt file do you run in the console?

winedata.

Scherm­afbeelding 2024-01-08 om 12.05.19

This is my result with winedata.txt
M1 Pro macbook 16gb

I’ve added some more pragmas and loop variables are improved.

On Battery (with Power Saving enabled) or via Power Cable?

with power cord ofcourse.

1 Like

Similar results for me. Although I’ve seen processing times vary quite a lot. This is from 3 runs with your code compiled to UB.

1 Like

pretty close to C++ …:wink:

2 Likes

ELAPSED 0.614172
on M2 max macbookpro (console version)

1 Like

i changed the structure (original project) into a class. It did slow it down a tiny bit somehow.
The improvements are to the loop boundaries and pragmas added to all methods.
Including that i’m building with arm-64 macos and use xojo 2023 R4 on aggressive optimization.

So it looks like Native ML can be done in Native Xojo. It may need a little more fine-tuning.

2 Likes