Array() function using Pairs causes slow Aggressive Compile

More testing shows it’s not specific to Pairs or the Array() function.

However, using Variants appears to be the key.

As a test, I tired creating a new class that uses only strings and doubles like this:

class cPair
  Constructor( name as string, temp as double)
    me.name=name
    me.temp=temp

function GetStationList as cPair()
  var stations() as cPair
  stations.append new cPair("Abha", 18.0)
  stations.append new cPair("Abidjan", 26.0)
  stations.append new cPair("Abéché", 29.4)
  stations.append new cPair("Accra", 26.4)
  [ ... 400 more ... ]

I did a few variations of parameters (e.g. using unique vs. the same strings and doubles on each line) but all compiled in 2 minutes.

Compile time  kind
-----------------------------------------
120 seconds   append new cPair(x,y) // different string and double on every line
120 seconds   append new cPair("foobar", y) // same string, different double on every line
120 seconds   append new cPair("foobar", 999) // same string and double on every line
120 seconds   append new cPair() // empty constructor

However, if I change my class to use Variants:

class cPairVariant
  Constructor( name as variant, temp as variant)
    me.name=name
    me.temp=temp

Then I see the pathological behavior:

Compile time  kind
-----------------------------------------
600+ seconds   append new cPairVariant("foobar", 999) // same string and double on every line
600+ seconds   append new cPairVariant(kFoobar, k999) // same string and double on every line, using a Const in code
120  seconds   append new cPairVariant() // empty constructor

Note: 600+ means I gave up after 10 minutes

It appears to be something specific to the convert-to-variant pathway which is generating code that the LLVM compiler is having trouble with.

I’ve updated the Issue with this info.

1 Like