icicle-lang / icicle-ambiata

A streaming query language.
BSD 3-Clause "New" or "Revised" License
57 stars 11 forks source link

simplify anormal pass #651

Closed amosr closed 6 years ago

amosr commented 6 years ago

/jury approved @jystic

jacobstanley commented 6 years ago

Seems reasonable, what's the story here?

amosr commented 6 years ago

the conversion to ANF is renaming way more variables than it needs to, and we should be able to take advantage of the fact that the input program never has shadowing, in order to limit renaming variables.

but this implementation is wrong, I just found a case which fails:

let a = (let b = 0 in b + 1)
\b. a + b

==>

let b = 0
let a = b + 1
\b. a + b
amosr commented 6 years ago

actually, it wasn't the renaming that was taking so long, it was the fact that the bookkeeping for what to rename was done in a separate pass, as well as converting a list to a set on every iteration.

amosr commented 6 years ago

A fact with 200 int fields

feature ints200 ~> group a1 ~> latest 1 ~> fields

45.2s -> 3.44s

!!!

jacobstanley commented 6 years ago

45.2s -> 3.44s

Wow!!

amosr commented 6 years ago

yeah, it's crazy!

jacobstanley commented 6 years ago

I can only imagine how bad it is for a 500 field struct

amosr commented 6 years ago

let's find out!

amosr commented 6 years ago
feature ints500 ~> group a1 ~> latest 1 ~> fields

918.87s -> 31.56s
tranma commented 6 years ago

unreal

jacobstanley commented 6 years ago

Winning, going to make a huge difference

jacobstanley commented 6 years ago

:100: