soegaard2
2022-6-22 15:00:59

@sorawee I was surprised that removing the contract from bitvector-ref reduced the runtime that much. In hindsight it makes sense, since bitvector-ref does little work per call and thus the cost of the contract is relatively large. Well spotted.


sorawee
2022-6-22 16:02:16

@sorawee has joined the channel


sorawee
2022-6-22 17:24:05

My understanding (could be wrong) is that contracts make chaperone, which inhibits many optimizations.

I wonder if provide/contract for simple function contracts could instead create a macro. If it is used as an identifier macro, then it creates a chaperone, but if it is immediately applied, then it doesn’t create a chaperone, but make special wrappers that checks preconditions and postconditions directly.


samth
2022-6-22 17:26:40

@sorawee it already does that


sorawee
2022-6-23 02:45:55

That doesn’t explain why switching from provide/contract to provide speeds things up so much, then.


samth
2022-6-23 02:50:44

The code that the contract library generates for the check is expensive, but doesn’t use a chaperone


samth
2022-6-23 02:53:11

I recommend looking at the expansion