MCausc78 / pyvolt

An API wrapper for Revolt written in Python.
MIT License
4 stars 1 forks source link

Don't construct flags when parsing #8

Closed MCausc78 closed 3 weeks ago

MCausc78 commented 3 weeks ago

Fixes #7.

This PR improves performance as well. (100000 members changed to 10000)

PS D:\Testing\Revolt\pyvolt> py -m bench
Benchmarking DMChannel parsing.
[DMChannel] Time using pyvolt ----: 0.113715 seconds
[DMChannel] Time using revolt.py -: 0.154588 seconds
[DMChannel] Time using voltage ---: 2.902508 seconds
Benchmarking GroupChannel parsing.
[GroupChannel] Time using pyvolt ----: 0.178373 seconds
[GroupChannel] Time using revolt.py -: 0.266662 seconds
[GroupChannel] Time using voltage ---: 7.812442 seconds
Benchmarking TextChannel parsing.
[TextChannel] Time using pyvolt ----: 0.363690 seconds
[TextChannel] Time using revolt.py -: 9.027268 seconds
[TextChannel] Time using voltage ---: 16.484010 seconds
Benchmarking Member parsing.
[Member] Time using pyvolt ----: 0.050229 seconds
[Member] Time using revolt.py -: 0.400820 seconds
[Member] Time using voltage ---: 0.594839 seconds
Benchmarking Message parsing.
[Message] Time using pyvolt ----: 0.046898 seconds
[Message] Time using revolt.py -: 0.255835 seconds
[Message] Time using voltage ---: 0.585127 seconds
Benchmarking Server parsing.
[Server] Time using pyvolt ----: 0.519747 seconds
[Server] Time using revolt.py -: 4.325845 seconds
[Server] Time using voltage ---: 11.870373 seconds
Benchmarking User parsing.
[User] Time using pyvolt ----: 0.621675 seconds
[User] Time using revolt.py -: 1.034088 seconds
[User] Time using voltage ---: 3.454861 seconds
PS D:\Testing\Revolt\pyvolt> py
Python 3.12.3 (tags/v3.12.3:f6650f9, Apr  9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> sum([0.113715,0.178373,0.363690,0.050229,0.046898,0.519747,0.621675])
1.8943269999999999
>>>