potassco / clorm

🗃️ A Python ORM-like interface for the Clingo Answer Set Programming (ASP) reasoner
https://clorm.readthedocs.io
MIT License
52 stars 5 forks source link

speeding up clorm #101

Open florianfischer91 opened 2 years ago

florianfischer91 commented 2 years ago

I would like to ask if clorm could be shipped with the possibility to compile it down to c/c++ (using cython)? I saw that pydantic also provide this feature and they are talking about a performance improvement of about 30-50%. I played around a bit and with small changes in the source code (still valid python) i was able to compile it with cython. Running some benchmarks (with files in profiling-dir) looks quite nice especially when looping comes into play, f.i. creating and adding 500k facts to a factbase is about 38% faster or querying a factbase to find one element is about 32% faster. For the full cython vs non-cython benchmark compare these two files noncython.md cython.md

If you like it just let me know and i'm keen to create a PR.