DEV Community

David Haley
David Haley

Posted on

The cost of types

As much as I like types (see previous posts), here is the cost of the safety.

This whole PR is to support generic types correctly:
https://github.com/dchaley/deepcell-imaging/pull/117

TIL, when using fused types in cython, it doesn't generate all possible fuse combinations: it assumes they match across parameters. So I had to create a new, identical fused type.

This is going into scikit, aka hundreds, thousands, or more developers. Since the benefit "multiplies" across those folks I still believe the cost of type shenanigans is worth it 😎 But, it is certainly a cost and types can feel slow or clunky when starting a project.

Top comments (1)

Collapse
 
dchaley profile image
David Haley

<several hours later…>

The types are still costing time… it's quite a bit to work with types across Python & Cython 🤯

I'm really eyeing that >15x speedup as the prize…