Ondřej Súkup
5317774364
- update to 0.10.0.0 * Performance improvements: + Direct encoding via the new toEncoding method is over 2x faster than toJSON. (You must write or code-gen a toEncoding implementation to unlock this speedup. See below for details.) + Improved string decoding gives a 12% speed win in parsing string-heavy JSON payloads (very common). + Encoding and decoding of time-related types are 10x faster (!!) as a result of bypassing Data.Time.Format and the arbitrary-precision Integer type. + When using toEncoding, [Char] can be encoded without a conversion to Text. This is fast and efficient. + Parsing into an Object is now 5% faster and more allocation-efficient. * SUBTLE API CHANGES, READ CAREFULLY: + With the exception of long-deprecated code, the API changes below should be upwards compatible from older versions of aeson. If you run into upgrade problems, please file an issue with details. + The ToJSON class has a new method, toEncoding, that allows direct encoding from a Haskell value to a lazy bytestring without construction of an intermediate Value. + The performance benefits of direct encoding are significant: more than 2x faster than before, with less than 1/3 the memory usage. + To preserve API compatibility across upgrades from older versions of this library, the default implementation of toEncoding uses toJSON. You will not see any performance improvement unless you write an implementation of toEncoding, which can be very simple: instance ToJSON Coord where toEncoding = genericToEncoding defaultOptions (Behind the scenes, the encode function uses toEncoding now, so if you implement toEncoding for your types, you should see a speedup immediately.) + If you use Template Haskell or GHC Generics to auto-generate your ToJSON OBS-URL: https://build.opensuse.org/request/show/352123 OBS-URL: https://build.opensuse.org/package/show/devel:languages:haskell/ghc-aeson?expand=0&rev=10
146 lines
3.9 KiB
RPMSpec
146 lines
3.9 KiB
RPMSpec
#
|
|
# spec file for package ghc-aeson
|
|
#
|
|
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
|
|
#
|
|
# All modifications and additions to the file contributed by third parties
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
# upon. The license for this file, and modifications and additions to the
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
# license for the pristine package is not an Open Source License, in which
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
# published by the Open Source Initiative.
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
#
|
|
|
|
|
|
%global pkg_name aeson
|
|
|
|
%bcond_with tests
|
|
|
|
Name: ghc-aeson
|
|
Version: 0.10.0.0
|
|
Release: 0
|
|
Summary: Fast JSON parsing and encoding
|
|
License: BSD-3-Clause
|
|
Group: System/Libraries
|
|
|
|
Url: https://hackage.haskell.org/package/%{pkg_name}
|
|
Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
|
BuildRequires: ghc-Cabal-devel
|
|
BuildRequires: ghc-rpm-macros
|
|
# Begin cabal-rpm deps:
|
|
BuildRequires: ghc-attoparsec-devel
|
|
BuildRequires: ghc-bytestring-devel
|
|
BuildRequires: ghc-containers-devel
|
|
BuildRequires: ghc-deepseq-devel
|
|
BuildRequires: ghc-dlist-devel
|
|
BuildRequires: ghc-hashable-devel
|
|
BuildRequires: ghc-mtl-devel
|
|
BuildRequires: ghc-scientific-devel
|
|
BuildRequires: ghc-syb-devel
|
|
BuildRequires: ghc-template-haskell-devel
|
|
BuildRequires: ghc-text-devel
|
|
BuildRequires: ghc-time-devel
|
|
BuildRequires: ghc-unordered-containers-devel
|
|
BuildRequires: ghc-vector-devel
|
|
%if %{with tests}
|
|
BuildRequires: ghc-HUnit-devel
|
|
BuildRequires: ghc-QuickCheck-devel
|
|
BuildRequires: ghc-test-framework-devel
|
|
BuildRequires: ghc-test-framework-hunit-devel
|
|
BuildRequires: ghc-test-framework-quickcheck2-devel
|
|
%endif
|
|
# End cabal-rpm deps
|
|
|
|
%description
|
|
A JSON parsing and encoding library optimized for ease of use and high
|
|
performance.
|
|
|
|
To get started, see the documentation for the 'Data.Aeson' module below.
|
|
|
|
Parsing performance on an early 2011 MacBook Pro (2.2GHz Core i7), running
|
|
64-bit GHC 7.6.3, for mostly-English tweets from Twitter's JSON search API:
|
|
|
|
* 0.8 KB: 34124 msg/sec (27.8 MB/sec)
|
|
|
|
* 6.4 KB: 6833 msg/sec (43.0 MB/sec)
|
|
|
|
* 11.8 KB: 3410 msg/sec (39.2 MB/sec)
|
|
|
|
* 31.2 KB: 1157 msg/sec (35.3 MB/sec)
|
|
|
|
* 61.5 KB: 542 msg/sec (32.5 MB/sec)
|
|
|
|
Handling heavily-escaped text is a little more work. Here is parsing
|
|
performance with Japanese tweets, where much of the text is entirely
|
|
Unicode-escaped.
|
|
|
|
* 14.6 KB: 2101 msg/sec (30.0 MB/sec)
|
|
|
|
* 44.1 KB: 667 msg/sec (28.7 MB/sec)
|
|
|
|
* 82.9 KB: 360 msg/sec (29.2 MB/sec)
|
|
|
|
Encoding performance on the same machine and data:
|
|
|
|
* English, 0.8 KB: 109697 msg/sec (89.3 MB/sec)
|
|
|
|
* English, 6.4 KB: 18517 msg/sec (116.4 MB/sec)
|
|
|
|
* Engish, 61.5 KB: 1963 msg/sec (118.0 MB/sec)
|
|
|
|
* Japanese, 14.6 KB: 12140 msg/sec (173.5 MB/sec)
|
|
|
|
* Japanese, 44.1 KB: 3980 msg/sec (171.3 MB/sec)
|
|
|
|
(A note on naming: in Greek mythology, Aeson was the father of Jason.).
|
|
|
|
|
|
%package devel
|
|
Summary: Haskell %{pkg_name} library development files
|
|
Group: Development/Libraries/Other
|
|
Requires: ghc-compiler = %{ghc_version}
|
|
Requires(post): ghc-compiler = %{ghc_version}
|
|
Requires(postun): ghc-compiler = %{ghc_version}
|
|
Requires: %{name} = %{version}-%{release}
|
|
|
|
%description devel
|
|
This package provides the Haskell %{pkg_name} library development files.
|
|
|
|
|
|
%prep
|
|
%setup -q -n %{pkg_name}-%{version}
|
|
|
|
%build
|
|
%define cabal_configure_options -f"old-time"
|
|
%ghc_lib_build
|
|
|
|
%install
|
|
%ghc_lib_install
|
|
|
|
%check
|
|
%if %{with tests}
|
|
%cabal test
|
|
%endif
|
|
|
|
%post devel
|
|
%ghc_pkg_recache
|
|
|
|
%postun devel
|
|
%ghc_pkg_recache
|
|
|
|
%files -f %{name}.files
|
|
%defattr(-,root,root,-)
|
|
%doc LICENSE
|
|
|
|
%files devel -f %{name}-devel.files
|
|
%defattr(-,root,root,-)
|
|
%doc README.markdown examples
|
|
|
|
%changelog
|