Skip to content
项目

yosiat/panko_serializer

在 GitHub 查看

关于

面向 ActiveRecord 和 Ruby 对象的高性能 JSON 序列化

开发工具

这些数字如何统计

实测星标增长

24小时
0
7天
-1
15天
-1
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Panko

Build Status

Panko is a library which is inspired by ActiveModelSerializers 0.9 for serializing ActiveRecord/Ruby objects to JSON strings, fast.

Panko is pure Ruby: no native extension, nothing to compile at install. It needs Ruby 3.4+ and ActiveSupport 7.2+. To achieve its performance:

  • Code generation: each serializer is compiled once into specialized, straight-line Ruby, so serialization runs no per-record introspection and YJIT optimizes it well.
  • Auto-specialization: the first time a serializer meets an ActiveRecord class, Panko compiles a variant hard-wired to that model, reading values straight from its attribute storage.
  • Oj: JSON is written incrementally using Oj::StringWriter.

To dig deeper about the performance choices, read Design Choices.

Coming from 0.8 (the C extension)? Read Upgrading from 0.8.

Support

License

The gem is available as open source under the terms of the MIT License.

探索相关项目

加载中…