Skip to content

Support udecimal library in code generation #700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 8, 2025

Conversation

michaelwilner
Copy link
Contributor

The quagmt/udecimal library offers some striking performance gains over shopspring/decimal especially when parsing and serializing strings. Benchmarks from udecimal reflect 1-2 orders of magnitude improvement on these paths

goos: linux
goarch: amd64
pkg: github.com/quagmt/udecimal/benchmarks
cpu: Intel(R) Core(TM) i9-14900HX
                                                                                            │   shopspring   │                udecimal                │
                                                                                            │     sec/op     │    sec/op     vs base                  │
Parse/1234567890123456789.1234567890123456879-32                                               384.35n ± 10%   25.16n ±  5%  -93.45% (p=0.000 n=10)
Parse/123-32                                                                                   77.475n ± 13%   8.046n ±  8%  -89.61% (p=0.000 n=10)
Parse/123456.123456-32                                                                         128.35n ±  5%   13.25n ±  3%  -89.68% (p=0.000 n=10)
Parse/1234567890-32                                                                             82.47n ±  7%   11.20n ±  1%  -86.42% (p=0.000 n=10)
Parse/0.1234567890123456879-32                                                                 262.30n ± 17%   17.89n ±  4%  -93.18% (p=0.000 n=10)
Parse/12345678901234567890123456789.123-32                                                     312.20n ±  8%   48.83n ±  3%  -84.36% (p=0.000 n=10)
ParseFallBack/123456789123456789123456.1234567890123456-32                                      373.2n ± 13%   337.6n ±  2%        ~ (p=0.105 n=10)
ParseFallBack/111222333444555666777888999.1234567890123456789-32                                418.5n ±  5%   325.9n ±  5%  -22.12% (p=0.000 n=10)
String/1234567890123456789.1234567890123456879-32                                              284.45n ± 26%   53.19n ±  3%  -81.30% (p=0.000 n=10)
String/123-32                                                                                  110.55n ±  7%   14.72n ±  2%  -86.68% (p=0.000 n=10)
String/123456.123456-32                                                                        133.00n ± 10%   27.95n ±  6%  -78.99% (p=0.000 n=10)
String/1234567890-32                                                                           145.45n ± 18%   24.37n ±  3%  -83.25% (p=0.000 n=10)
String/0.1234567890123456879-32                                                                173.80n ± 15%   34.36n ± 11%  -80.23% (p=0.000 n=10)
String/12345.1234567890123456789-32                                                            241.90n ±  4%   37.68n ±  5%  -84.42% (p=0.000 n=10)
StringFallBack/123456789123456789123456.1234567890123456-32                                     394.1n ± 15%   174.1n ±  3%  -55.82% (p=0.000 n=10)
StringFallBack/111222333444555666777888999.1234567890123456789-32                               353.4n ± 26%   174.4n ±  8%  -50.65% (p=0.000 n=10)

Performance compared between the FIXUDecimal and FIXDecimal types:

goos: darwin
goarch: arm64
pkg: github.com/quickfixgo/quickfix
cpu: Apple M3 Pro
BenchmarkFIXUDecimalRead
BenchmarkFIXUDecimalRead-11     	53151679	        22.33 ns/op
BenchmarkFIXUDecimalWrite
BenchmarkFIXUDecimalWrite-11    	29959304	        39.36 ns/op
BenchmarkFIXDecimalRead
BenchmarkFIXDecimalRead-11     	13141797	        79.57 ns/op
BenchmarkFIXDecimalWrite
BenchmarkFIXDecimalWrite-11    	 5214294	       235.6 ns/op

@michaelwilner michaelwilner force-pushed the udecimal-support branch 4 times, most recently from 5a95acc to f9dfd4c Compare March 7, 2025 20:15
@ackleymi ackleymi merged commit bc1d3ac into quickfixgo:main Mar 8, 2025
47 checks passed
@michaelwilner michaelwilner deleted the udecimal-support branch May 18, 2025 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants