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

Feature: Task.to_dict #216

Merged
merged 1 commit into from
May 29, 2023
Merged

Feature: Task.to_dict #216

merged 1 commit into from
May 29, 2023

Conversation

psrok1
Copy link
Member

@psrok1 psrok1 commented May 25, 2023

Serialization is splitted to Task.to_dict that is then used by Task.serialize

It should be a bit more efficient than json.dumps(cls=...) and enables us to use orjson for serialization as well:

In [10]: timeit.timeit(lambda: karton.core.task.Task({}).serialize(), number=100000)
Out[10]: 1.5992015590891242

vs

In [6]: timeit.timeit(lambda: karton.core.task.Task({}).serialize(), number=100000)
Out[6]: 1.1377838689368218

closes #209

@psrok1 psrok1 requested a review from nazywam May 25, 2023 10:53
@psrok1 psrok1 merged commit d0b1719 into master May 29, 2023
@psrok1 psrok1 deleted the feature/task-to-dict branch May 29, 2023 12:56
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.

Make it possible to convert task to dict
2 participants