[Ur] compiler time/space depending on number of table attributes

Marko Schütz Schmuck markoschuetz at googlemail.com
Thu Mar 2 16:46:45 EST 2017


Dear All,

I naïvely tried compiling a source code file with a table having 15
attributes, 3 of which form the key. Also, that table is used with
Csv.importTable from upo.

After a few seconds the compiler uses 4GB of memory and 100% CPU and
seems stuck. If I reduce the number of attributes to 12 it compiles in
~2m30s total and with only 4 attributes it's done in ~24s total.

In this case I actually do not need all the attributes, but for a
future extension I would. I wondered whether the type checker is to
blame, but it appears not: with -tc the compiler takes ~24s total for
the file with the 15 attributes.

Any recommendations?

Best regards,

Marko

-------------- next part --------------
table sections : { A1 : string, A2 : int, A3 : string, A4 : string,
                   A5 : string, A6 : string, A7 : int, A8 : int,
                   A9 : string, A10 : int, A11 : int, A12 : string,
                   A13 : string, A14 : int, A15 : string}
                     PRIMARY KEY (A1, A2, A4)

fun fileText (r : {File : file}) : string =
    BlobText.blobText (fileData r.File)

fun importSections (r : {File : file}) : transaction page =
    Csv.importTable sections (fileText r) ;
    return <xml>Success</xml>

fun main () : transaction page
  = return <xml><body>
  <h1>The Amazing File Importer!</h1>

  <form>Import a file: <upload{#File}/> <submit action={importSections}/></form>
</body></xml>

-------------- next part --------------
val main : unit -> transaction page

-------------- next part --------------
database dbname=sandbox
sql test.sql
allow mime text/plain
allow mime text/csv
allow mime image/png
allow mime image/gif
library blobText
library /home/marko/src/upo

$/string

test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP Digital Signature
URL: <http://www.impredicative.com/pipermail/ur/attachments/20170302/607bd3d8/attachment.sig>


More information about the Ur mailing list