iboB

Hi all,

We at Chobolabs have developed a C++ runtime, which is available here:
https://github.com/Chobolabs/spine-cpp

While it is mostly a copy of the existing spine-c runtime, its most notable difference is that it utilizes the cpu cache better, leading to better performance. This is especially noticeable on mobile devices.

Also it has a faster json loader (but unless you're loading tens or more animations at a time, this will hardly be noticeable)

You're welcome to try whether it is beneficial for you.
It’s only when you look at an ant through a magnifying glass on a sunny day that you realize how often they burst into flames.
User avatar
iboB
Posts: 3

Nate

It looks well done, cheers! :) I've added it to the runtimes page.

Can you point to the part that makes better use of the CPU cache? I'm curious.
User avatar
Nate

Nate
Posts: 6809

iboB

The most important thing in this case is that curve timelines (the most popular ones) use a single buffer for frame data unless the curve is a Bezier one (and indeed most often the curve is not Bezier). Spine-c on the other hand uses two buffers: one for curve data, and one for frame data. See here ( https://github.com/Chobolabs/spine-cpp/blob/master/include/spinecpp/Timelines.h ) how curve timelines have frames inherited from CurveFrame. In our implementation Bezier curves still would cause a L1 cache miss for each frame, but most curves aren't such.

The other thing is that the bones of a skeleton are a in a single dense buffer (instead of individually allocated like in spine-c). Thus iterating through bones has fewer L1 cache misses, since big chunks of bones would be present in L1 cache at the same time.

There are other minor examples, but our goal was to localize most data structures. We try to always have a buffer of values instead of buffer of pointers to values.

In the near future we plan on cache-localizing timelines as a whole, by adding a special timeline allocator. This hasn't been tested yet, but we expect to gain a few more percent of performance that way.
It’s only when you look at an ant through a magnifying glass on a sunny day that you realize how often they burst into flames.
User avatar
iboB
Posts: 3

Nate

Thanks, it makes sense. Moving the curve type to the frames array (and using a struct) is nice, I'd like to do something similar for spine-c. However, it is quite common to use Bezier on nearly all keys. Keeping the bones together is nice too. :yes:
User avatar
Nate

Nate
Posts: 6809

jdtec86

Looks really nice! Good work. Makes me think I should open source some of my own Spine 'add-on/helper' code more and more.

I might grab this for my next project or when I get some spare time to upgrade if it continues to be maintained.
jdtec86
Posts: 43

iboB

The runtime is updated to work with Spine v3.4
It’s only when you look at an ant through a magnifying glass on a sunny day that you realize how often they burst into flames.
User avatar
iboB
Posts: 3

badlogic

Awesome!
User avatar
badlogic

Mario
Posts: 566


Return to Runtimes