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

Maybe: Numpy support #337

Open
facelessuser opened this issue Jul 21, 2023 · 2 comments
Open

Maybe: Numpy support #337

facelessuser opened this issue Jul 21, 2023 · 2 comments
Labels
P: maybe Pending approval of low priority request. skip-triage Tells bot to not tag a new issue with 'triage'. T: enhancement Enhancement.

Comments

@facelessuser
Copy link
Owner

I've gone back and forth on this. ColorAide currently doesn't require any dependencies as it is all implemented in pure Python. With that said, it suffers from the performance downside of being pure Python. For many, pure Python is likely more than sufficient, but there may be use cases that would really like better performance.

It would be nice if there was a compatibility layer to allow for speed increase. The problem is that while we can vectorized everything so that abstraction is easier, general vectorization is slower in pure Python than sometimes directly iterating and apply calculations. In Numpy, vectorization is the way to go for optimal speed.

Currently, I use ColorAide in some places where not using Numpy is actually helpful. It is possible we could have two versions, but that also doubles the maintenance burden.

I think abstraction would be difficult as we would sacrifice more performance to gain performance when Numpy is available. I think supporting two variants is probably too much maintenance.

If we were to do this, we would probably just switch over to Numpy in some major release. This would be a huge change. This would require gutting our current matrix support in algebra and making ColorAide use Numpy everywhere, vectorizing as much as possible so that we get the performance boosts. This would require us to prototype it and benchmark it.

Anyways, I don't know if/when this would happen, but I figure we can keep this open as a possibility. I have heartedly looked into this before, but the only way is to go all in, if we do this.

@facelessuser facelessuser added T: enhancement Enhancement. P: maybe Pending approval of low priority request. skip-triage Tells bot to not tag a new issue with 'triage'. labels Jul 21, 2023
@dofuuz
Copy link

dofuuz commented Feb 27, 2024

NumPy is de facto standard in Python, so I think it's better to use it if there are any advantages.

What I want for ColorAide is N-dimensional array(ndarray) processing. So it can deal with images, not only the single color.
Introducing NumPy can solve that kind of things.

@facelessuser
Copy link
Owner Author

That's an interesting thought. If we were to do something like N-dimensional colors, that would be a huge rework, or maybe it would be a reimagined ColorAide from the ground up. It's something to think about, but it would be a lot of work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P: maybe Pending approval of low priority request. skip-triage Tells bot to not tag a new issue with 'triage'. T: enhancement Enhancement.
Projects
None yet
Development

No branches or pull requests

2 participants