a2 / MessagePack.swift

It's like JSON, but fast and small…and Swift! – msgpack.org[Swift]
http://msgpack.org
MIT License
283 stars 60 forks source link

Uber speed #45

Closed BrettThePark closed 7 years ago

BrettThePark commented 7 years ago

The recent update to Swift 3.1 causes the memory usage size of message pack to balloon again (the subdata call causes a copy of the data rather than an in-place references).

In order to fix the memory ballooning issue, and to improve speed, I chose to make a RemainderData class which allows the data to return the remainder without copying the data. I have been using some of the optimizations for 5 or 6 months.

Opinions welcome.

BrettThePark commented 7 years ago

It appears the checks failed due to some error other than my code ...

a2 commented 7 years ago

I like the direction this is going! I've been thinking about a way to accomplish the same goal without introducing a new type. I'm going to experiment with my idea and put up a PR within the next couple of days. Thank you!

Edit: Okay, in new realizations, the generics-constrained version was a bit too complicated. I'm going to go with a simpler additional type such that the changes are as few as possible.