Author Topic: Array Class Challenge  (Read 9047 times)

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Array Class Challenge
« on: November 12, 2019, 02:57:02 PM »
Over on the Raspberry Pi forum I created an array extension module due to ScriptBasic arrays (linked lists) being so slow. I thought this might be a good challenge here on the AllBASIC.info forum.

Array Class

Linux Array Librarry

Extra points for dumping arrays to .CSV and XML files.

All languages welcome.
« Last Edit: November 12, 2019, 05:57:18 PM by John »

Mike Lobanovsky

  • Guest
Re: Array Class Callenge
« Reply #1 on: November 12, 2019, 05:05:34 PM »
Not sure if your extension module written in an interpreted language can beat the performance of native array functionality built into the core by the language developer.

Interpretation usually runs some 100 times slower than native code.

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Array Class Challenge
« Reply #2 on: November 12, 2019, 05:18:04 PM »
The TA extension module is based on a static C array in a shared object. I needed 100,000,000 elements for the Tatami 200 challenge. SB could only do 120 and slow as hell.  With the TA extension module I'm 15 seconds slower than the pure C version.

Tatami 200 RPi Challenge
« Last Edit: November 12, 2019, 05:57:56 PM by John »

Mike Lobanovsky

  • Guest
Re: Array Class Challenge
« Reply #3 on: November 13, 2019, 01:51:24 AM »
Quote
I needed 100,000,000 elements for the Tatami 200 challenge.

Thanks John,

At least now we can see what the subject of the challenge looks like...

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Array Class Challenge
« Reply #4 on: November 13, 2019, 10:20:23 AM »
The ScriptBasic submission will look like BASIC even though it is done in C.

Mike Lobanovsky

  • Guest
Re: Array Class Challenge
« Reply #5 on: November 14, 2019, 03:57:46 AM »
Heh, another try to make myself clearer:

"At least now we can see what the subject of the challenge is all about..."

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Array Class Challenge
« Reply #6 on: November 14, 2019, 06:54:13 PM »
The best part is we can share functions among our array libraries.

I plan to release a ScriptBasic extension module and a generic shared object of the library.
« Last Edit: November 14, 2019, 06:57:36 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Array Class Challenge
« Reply #7 on: November 15, 2019, 05:24:35 PM »
Heh, another try to make myself clearer:

"At least now we can see what the subject of the challenge is all about..."

That BASICally went over my head.  :o

Mike Lobanovsky

  • Guest
Re: Array Class Challenge
« Reply #8 on: November 15, 2019, 06:41:38 PM »
OK,

So the challenge is about creating a standalone module to basically extend BASIC array basic features and incorporate extra high-level functionality.

Then why not do the most obvious thing (for the dialects that don't have such features built into the core): create a CPP DLL with a flat ANSI C interface that would encapsulate some or all of simple data vector classes and export their standard high-level methods for use by dialects that support calls to external dynamic link libraries/shared objects at all?

I bet this would be the fastest library possible if compiled with the VC++/G++ maximum optimization settings.

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Array Class Challenge
« Reply #9 on: November 16, 2019, 01:21:16 AM »
Sounds like a great idea for Windows. Maybe you could write it in O2?

I'm focused on a Linux solution.

Judy
« Last Edit: November 16, 2019, 02:59:35 AM by John »