Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up converter texture packing with Cython #1671

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fabiobarkoski
Copy link
Contributor

@fabiobarkoski fabiobarkoski commented Aug 7, 2024

Improve texture converter performance with Cython

resolve: #1371

Copy link
Member

@heinezen heinezen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey looks good for now. I think you got the basics of Cython right. What would be your next steps?

openage/convert/service/export/png/binpack.pyx Outdated Show resolved Hide resolved
openage/convert/service/export/png/binpack.pyx Outdated Show resolved Hide resolved
openage/convert/service/export/png/binpack.pyx Outdated Show resolved Hide resolved
openage/convert/service/export/png/binpack.pyx Outdated Show resolved Hide resolved
@fabiobarkoski
Copy link
Contributor Author

I think you got the basics of Cython right

Is there anything that I could improve?

What would be your next steps?

I'll try to make the additional optimizations

@heinezen heinezen linked an issue Sep 29, 2024 that may be closed by this pull request
3 tasks
@heinezen
Copy link
Member

@fabiobarkoski I think from a perspective of cythonization of the members and variables, the code is already pretty optimized. We now can only gain more speed with design changes to the code.

I think that this idea from the issue might be worth a try:

Currently pack() gets passed a list of frame objects, but technically only width, height and index of a frame are needed.

The idea here being is that pack doesn't get a list of TextureImage (i.e. members named block in the code) but a list that only contains a tuple of (width, height) and then only operates on that. This would also require that we use the block index in self.mapping instead of hashing the block itself.

@fabiobarkoski fabiobarkoski force-pushed the feature/speed-up-converter-texture-packing branch from 4b749c9 to 6fefdb4 Compare November 25, 2024 19:52
cythonized more the texture packing, also changed the
list passed to factor(), before was a list of frame objects, now
a list of only width, height and index of the frames.
@fabiobarkoski fabiobarkoski force-pushed the feature/speed-up-converter-texture-packing branch from 6fefdb4 to e227a43 Compare November 25, 2024 20:08
@fabiobarkoski fabiobarkoski marked this pull request as ready for review November 25, 2024 20:17
@fabiobarkoski fabiobarkoski changed the title [WIP] Speed up converter texture packing with Cython Speed up converter texture packing with Cython Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Speed up converter texture packing with Cython
2 participants