SPVM is released! Perl maybe become much fast.

I release SPVM.

SPVM

---------------------------------------------------------------------------

SPVM - Fast calculation, GC, static typing, VM with perlish syntax
SPVM(CPAN)

----------------------------------------------------------------------------

Do you know that there are many criticisms against Perl 5 on the Perl 11 blog?

Much of the criticism is about Perl's data structure and performance.

"Perl does not have a good data structure and implementation regarding numbers."

"Perl can not calculate a number using the stack of functions."

"Understanding about virtual machines is lacking in p5p."

I am an engineer who loves Perl 5 and p5p and is using Perl 5 to create a company service.

I want to contribute to reducing the weaknesses of Perl 5, by making modules.

I hope the SPVM will be of help.

Features

Do you need faster Perl? SPVM provides fast calculation to Perl.

  • Fast calculation - The Perl's biggest weak point is the calculation performance. SPVM provides fast calculations.
  • GC - You don't need to care about freeing memory
  • Static typing - Static typing for performance
  • VM - Byte codes are generated so that you can run them on SPVM language
  • Perlish syntax - SPVM syntax is very similar to Perl
  • Perl module - SPVM function can be called from Perl itself.

Example

use FindBin;
use lib "$FindBin::Bin/lib";
 
use SPVM 'MyModule2';
 
my $total = SPVM::MyModule2::foo(SPVM::int(3), SPVM::int(5));
print $total->value . "\n";

The following is SPVM module files. Extention is "spvm".

# lib/SPVM/MyModule1.spvm
package MyModule1 {
  has x : int;
  has y : int;
   
  sub sum ($a : int, $b : int) : int {
     
    my $total = $a + $b;
     
    return $total;
  }
}
 
# lib/SPVM/MyModule2.spvm
use MyModule1;
package MyModule2 {
   
  sub foo ($a : int, $b : int) : int {
     
    my $total = ($a * $b) + MyModule1::sum(2, 4);
     
    return $total;
  }
}

4 Comments

Hello Yuki,

I am a bit torn to learn about your work here. Performance is a big deal to me, so much so that I've started my own project to solve it. It seems like there is quite a bit of prior work in this arena and I worry you haven't reached out to other project leaders. Your work seems most closely aligned with rperl, but also addresses an issue that I've been trying to fix with C::Blocks. Could you perhaps comment how your project is different from both of those projects?

I see: you're tackling the same problem as rperl does, but with a different implementation approach. In fact, you're using the exact same implementation strategy as Perl itself, but focused on a strictly typed Perl-ish language. As a bonus, you're making it very easy to call from Perl (something rperl claims to do as well, without the need of a compiler after the module has been compiled once). Code written in your dialect will run faster than a pure Perl implementation because the bytecode compiler and interpreter do not have to check nearly as many corner cases. Have you toyed around with any benchmarks compared with pure Perl? Could I try writing some C::Blocks versions to compare? I'm very curious about the performance of this setup.

Leave a comment

About Yuki Kimoto

user-pic I'm Yuki Kimoto, Japanese Perl programmer.I create Perl modules and applications. GitPrep, SPVM, DBIx::Custom, Validator::Custom, Test::Mojo, Mojolicious::Plugin::AutoRoute, etc.