ipso icon indicating copy to clipboard operation
ipso copied to clipboard

Reduce allocations involved in temporary types?

Open LightAndLight opened this issue 3 years ago • 0 comments

The instruction count / heap usage of my usual benchmark (./scripts/{callgrind,dhat} examples/todolist.ipso < ipso-cli/benches/todolist_1_input.txt) crept up a little bit in #263.

I suspect it's from the extra types I create during checking. Examples:

  • https://github.com/LightAndLight/ipso/blob/c0fa35757400f17d9d55383281ebb63847dde603/ipso-typecheck/src/type_inference/mod.rs#L454-L462
  • https://github.com/LightAndLight/ipso/blob/c0fa35757400f17d9d55383281ebb63847dde603/ipso-typecheck/src/type_inference/mod.rs#L512-L524
  • https://github.com/LightAndLight/ipso/blob/c0fa35757400f17d9d55383281ebb63847dde603/ipso-typecheck/src/type_inference/mod.rs#L740-L745
  • https://github.com/LightAndLight/ipso/blob/c0fa35757400f17d9d55383281ebb63847dde603/ipso-typecheck/src/type_inference/mod.rs#L770-L780
  • https://github.com/LightAndLight/ipso/blob/c0fa35757400f17d9d55383281ebb63847dde603/ipso-typecheck/src/type_inference/mod.rs#L959-L967

and more.

These temporary types involve heap allocations, because they're recursive.

Is this a big deal and is there a cheap way to do it?

LightAndLight avatar Oct 30 '22 06:10 LightAndLight