|
|
|
|
|
by b2gills
2535 days ago
|
|
Someone once posted Perl6 and C/C++ code to #perl6 on freenode.net According to them, Perl6 was faster. (The Perl6 code was also a lot shorter, and I could argue it was easier to understand.) --- My guess is that the reason was that the C/C++ code had to scan for null terminators often, and copy strings around. (Or perhaps more precisely the stdlib had to do that.) MoarVM doesn't use null terminated strings, and it treats strings as immutable objects.
If you do something like create a substring, it creates a substring object that points into the original string. So rather than copying a bunch of data it basically just creates a pointer. (Strings are technically immutable in Perl6, it is easy to assume otherwise though.) |
|