-
Notifications
You must be signed in to change notification settings - Fork 7
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
Array<UInt8> is significantly slower than Data #14
Comments
Two questions:
Release mode makes a huge difference when working with I definitely want Vapor to move to |
Marking this as 2.0 milestone since moving from |
While trying to debug some performance issues I was having today, I realised the root of my problems was an insanely slow
parse
in Multipart. Not that the work I was doing was too slow - the parser itself was slow.I opened up the project in Xcode and added a simple test:
For a 332kB message, with two parts (some text and a JPEG image), the implementation using
Bytes
(i.e.[UInt8]
) took 0.422s. ReplacingBytes
withData
resulted in the same test executing in 0.0475s. That's nearly a 10x speedup.Now admittedly Multipart is a small library, and it wasn't zero work to change it over to use Data. Vapor as a whole is enormous, and such a changeover would require care and attention and a lot of work. But I think Bits really can't continue defining its own type for data when that type is so much slower than the native type. IMO, Bits should be a library for operating on Data objects, and Collections/Sequences of UInt8, and should ditch the Bytes type entirely.
The text was updated successfully, but these errors were encountered: