# Jitclass to StructRef migration

**URL:** <https://numba.discourse.group/t/jitclass-to-structref-migration/796>\
**Category:** Community Support\
**Created:** [July 10, 2021, 7:39am UTC](https://numba.discourse.group/t/jitclass-to-structref-migration/796 "2021-07-10T07:39:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LunarLanding](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/lunarlanding/32/290_2.png) [@LunarLanding](https://numba.discourse.group/u/LunarLanding)\
**Post date:** [July 10, 2021, 7:39am UTC](https://numba.discourse.group/t/jitclass-to-structref-migration/796/1 "2021-07-10T07:39:27Z")

</div>

Hi. I’m considering switching from jitclass to structref. I would like to know :

- if the resulting compilation of methods/initializers can be cached on disk, as normal functions are with njit(cache=True). For now, to keep cache working I am converting any jitclass to a tuple before they exit njited cached functions, and converting the tuple to the jitclass after they enter.
- the performance impact of repeatedly following the self.myfield references. I know this was/is(?) a concern with jitclasses due to reference counting. My usecase is long algorithms where I use closures extensively to capture locally constant values, compilation time ~ 2mn and load from disk is ~1s.
- the practicality of writting a wrapper to get a similar interface to the jitclass decorator.
- if it would be possible to take advantage of caching to iterate on a method implementation without triggering the recompilation of all methods on the structref.

I will get to test these, but any pointers would be appreciated.

---

<div class="post-metadata">

**Author:** ![nelson2005](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/nelson2005/32/47_2.png) [@nelson2005](https://numba.discourse.group/u/nelson2005)\
**Post date:** [July 10, 2021, 10:31pm UTC](https://numba.discourse.group/t/jitclass-to-structref-migration/796/2 "2021-07-10T22:31:47Z")

</div>

Recent thread that may be of [interest](https://github.com/numba/numba/issues/6522)
