mre/hyperjson

Zero-copy string deserialization

開放

#67 建立於 2019年9月21日

 (1 則留言) (0 個反應) (0 位負責人)Python (41 個分叉)github user discovery
enhancementgood first issuehacktoberfesthelp wanted

倉庫指標

星標
 (511 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Over on Reddit, @mikeyhew mentioned that there might be an option to parse JSON strings without copying:

Just wanted to point out that serde-json isn't zero-copy because it will copy strings to turn escape sequences like "\n" and "" into the character they represent. To parse JSON without copying, you could make a custom string type, JsonStr, which is utf-8 like str but can contain escape sequences.

I forgot about that, but it's actually a great idea! Here's the upstream discussion on serde-json. We should give this custom string type some serious consideration, as string allocation takes a big part of the encoding/decoding process at the moment.

If anyone wants to give it a shot, go for it.

貢獻者指南