Comments (4)
Have you looked into orjson? orjson is a larger library compared to ujson but its marginally faster in decoding benchmarks I think are more applicable to this project and its encoding speed is over 2x faster than ujson in all the benchmarks.
https://github.com/ultrajson/ultrajson#benchmarks
from hikari.
I did in fact look at it, but it seems to perform slower than ujson in our case. I re-ran the benchmarks provided by ujson
here and did see orjson
performing considerably better, but when it comes to a Discord workload, ujson
shows better performance. I havent really looked into it (a bit why I opened this issue instead of a PR).
You can test it out yourself by replacing this specific line with send_bytes
Line 201 in deb3ed1
If anyone can run performance tests on their bots, please feel free to share, they are greatly welcome!
PS: While looking into this, I stumbled on this issue from Sanic regarding the same results I encountered: sanic-org/sanic#1479 (comment)
from hikari.
So I've experimented on Carberretta, and the differences are pretty minimal. I tried 3 times with each, and these were the average results:
- Normal: 2.22s
- ujson: 2.17s
- orjson: 2.25s
I reckon some more data could be helpful, but there doesn't seem to be any major differences. The differences are smaller on a bot with more parts at the very least.
from hikari.
Since orjson
was brought up, I experimented a bit with it and came up this branch.
I am still not fully happy with the outcome and have some plans to improve it even more, bringing in support to be able to pass json.loads
and json.dumps
singnature compliant functions.
Regardless, any testing on that branch (specially in large bots, if possible) would be welcome and appreciated!
To install from the branch using pip, you can use:
pip install git+https://github.com/davfsa/hikari@task/orjson#egg=hikari[speedups]
from hikari.
Related Issues (20)
- Forum channels unrecognised HOT 2
- Localization attribute missing for CommandChoice HOT 1
- typing context not exiting after a webhook is called HOT 2
- Asyncio SSLProto error HOT 3
- Add support for comparing roles HOT 1
- Editing the icon of a server fails HOT 1
- Components shutdown before completion of event listeners
- Option to only cache the bot member HOT 1
- Consider removing upper bound constraint on python version HOT 4
- Support editing community features in `edit_guild` endpoint
- Implement monetization
- Implement default select values
- Specialize InteractionCreateEvent
- Consistent BitEnum Naming HOT 1
- Switch to msgspec HOT 4
- Support sending voice messages HOT 2
- Consider using mkdocs material HOT 3
- `Member.joined_at` is now nullable due to breaking API change
- Sync `guilds.GuildFeature` to Official API
- Support Polls
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hikari.