mirror of
https://github.com/valitydev/elixir-thrift.git
synced 2024-11-07 10:38:50 +00:00
819216f830
A pure Elixir implementation of the Thrift binary protocol. This PR includes serialization and deserialization for all thrift types as well as testing to make sure we match the thrift spec (which can be found here: https://erikvanoosten.github.io/thrift-missing-specification/#_binary_encoding) The binary protocol is generated alongside the thrift data types, yielding a much faster implementation than the apache project's canonical one. Our benchmarks (using benchfella) indicate a speedup of between 10 and 20x. ## Binary Protocol Performance benchmark name | iterations | average time ------------------|-----------|--------------- elixir serialization (left as IOList) | 2000 | 849.01 µs/op elixir serialization (iolist_size) | 2000 | 933.83 µs/op elixir serialization (converted to binary) | 1000 | 1281.23 µs/op elixir deserialization | 1000 | 1178.46 µs/op erlang serialization left as IOList | 100 | 10284.84 µs/op erlang serialization (converted to binary) | 100 | 11588.89 µs/op erlang deserialization | 100 | 21433.17 µs/op
85 lines
2.0 KiB
Elixir
85 lines
2.0 KiB
Elixir
defmodule Thrift.Mixfile do
|
|
use Mix.Project
|
|
|
|
@version "1.3.1"
|
|
@project_url "https://github.com/pinterest/elixir-thrift"
|
|
|
|
def project do
|
|
[app: :thrift,
|
|
version: @version,
|
|
elixir: "~> 1.2",
|
|
deps: deps,
|
|
|
|
# Build Environment
|
|
erlc_paths: erlc_paths(Mix.env),
|
|
erlc_include_path: "ext/thrift/lib/erl/include",
|
|
elixirc_paths: elixirc_paths(Mix.env),
|
|
compilers: [:leex, :yecc, :erlang, :elixir, :app],
|
|
|
|
# Testing
|
|
test_coverage: [tool: ExCoveralls],
|
|
preferred_cli_env: ["coveralls": :test, "coveralls.detail": :test, "coveralls.post": :test],
|
|
|
|
# URLs
|
|
source_url: @project_url,
|
|
homepage_url: @project_url,
|
|
|
|
# Hex
|
|
description: description,
|
|
package: package,
|
|
|
|
# Docs
|
|
name: "Thrift",
|
|
docs: [source_ref: "v#{@version}", main: "Thrift", source_url: @project_url]]
|
|
end
|
|
|
|
def application do
|
|
[]
|
|
end
|
|
|
|
defp erlc_paths(:prod) do
|
|
["src", "ext/thrift/lib/erl/src"]
|
|
end
|
|
|
|
defp erlc_paths(_) do
|
|
erlc_paths(:prod) ++ ["test/support/src"]
|
|
end
|
|
|
|
defp elixirc_paths(:prod) do
|
|
["lib"]
|
|
end
|
|
|
|
defp elixirc_paths(_) do
|
|
elixirc_paths(:prod) ++ ["test/support/lib"]
|
|
end
|
|
|
|
defp deps do
|
|
[{:ex_doc, "~> 0.14.3", only: :dev},
|
|
{:earmark, "~> 1.0.2", only: :dev},
|
|
{:excoveralls, "~> 0.5.7", only: :test},
|
|
{:credo, "~> 0.5.2", only: [:dev, :test]},
|
|
{:dialyxir, "~> 0.4.0", only: [:dev, :test]},
|
|
{:benchfella, "~> 0.3.0", only: [:dev, :test]}
|
|
]
|
|
end
|
|
|
|
defp description do
|
|
"""
|
|
A collection of utilities for working with Thrift in Elixir.
|
|
|
|
Provides a copy of the Apache Thrift Erlang runtime.
|
|
"""
|
|
end
|
|
|
|
defp package do
|
|
[maintainers: ["Jon Parise", "Steve Cohen"],
|
|
licenses: ["Apache 2.0"],
|
|
links: %{"GitHub" => @project_url},
|
|
files: ~w(README.md LICENSE mix.exs lib) ++
|
|
~w(ext/thrift/CHANGES ext/thrift/LICENSE ext/thrift/NOTICE) ++
|
|
~w(ext/thrift/README.md ext/thrift/doc ext/thrift/lib/erl) ++
|
|
~w(src/thrift_lexer.xrl src/thrift_parser.yrl)
|
|
]
|
|
end
|
|
end
|