[RFC] Possible PCT performance improvements.

Daniel Arbelo arbelo at gmail.com
Sat Aug 14 23:36:47 UTC 2010


On Sat, Aug 14, 2010 at 7:13 PM, Austin Hastings
<Austin_Hastings at yahoo.com> wrote:
> It seems likely to me that using
>     if $var.name[0] == '&' {
>
> might be faster, without any need to do any more work. Can you try this?

   Even though I'm not familiar with NQP's code generation code, I
doubt this could beat an ord op and integer comparisons, which would
obviate the allocation of a gc-able for the '&' constant, and also
shares the drawback that it doesn't work if the constant is more than
one character long. Take this two other bits from that file, for
example:

"if pir::substr(~$<typename>, 0, 2) eq '::' {"
"if pir::substr__SSII($<blockoid><statementlist><statement>[0], 0, 3)
eq '...' {"

   It's not a matter of making any particular bit of code go faster, I
haven't identified any real bottlenecks here. What I'm seeing here is
that a cumulatively expensive operation (substr) is being done very
often as part of an unrelated process. None of the code I've seen so
far is really interested in keeping that substring about, it's doing
something else.
   I'm trying to find out what that something else is, and if parrot
can do anything to support it better so that we can avoid substr's
side-effects in situations where they are unwanted.

Daniel


More information about the parrot-dev mailing list