Comments (4)
I did some experimentation with Angstrom and my basic parser was an order of magnitude slower than Pgx's current code. I might try a little bit more experimentation with flambda. It's also awkward to write since OCaml doesn't have unsigned types, so we either need to use the integers
library, which uses C code and is significantly slower, or pass around uint32's as int64's
from pgx.
We should probably look into how PG'OCaml and Postgres_async do serialization and see if we can come up with a base parser/serializer library that they could both theoretically use too.
from pgx.
Nevermind, it looks like if we add Async overhead into account, Angstrom_async actually reads data more efficiently than Pgx does, which massively swamps the difference in parse speed:
Estimated testing time 14s (14 benchmarks x 1s). Change using '-quota'.
┌─────────────────────────────────────────────────────────┬────────────┬─────────┬──────────┬──────────┬────────────┐
│ Name │ Time/Run │ mWd/Run │ mjWd/Run │ Prom/Run │ Percentage │
├─────────────────────────────────────────────────────────┼────────────┼─────────┼──────────┼──────────┼────────────┤
│ Authentication_ok.parse (string) │ 441.74ns │ 281.26w │ │ │ 10.68% │
│ Authentication_ok.parse (bigstring) │ 403.78ns │ 272.24w │ │ │ 9.77% │
│ Authentication_ok_int.parse (string) │ 190.38ns │ 221.11w │ │ │ 4.60% │
│ Authentication_ok_int.parse (bigstring) │ 123.72ns │ 212.07w │ │ │ 2.99% │
│ Authentication_ok_int_lift.parse (string) │ 158.35ns │ 155.09w │ │ │ 3.83% │
│ Authentication_ok_int_lift.parse (bigstring) │ 93.14ns │ 146.00w │ │ │ 2.25% │
│ Authentication_ok_int_lift.parse (unbuffered bigstring) │ 96.23ns │ 169.00w │ │ │ 2.33% │
│ Authentication_ok_int_lift.parse (async) │ 3_497.32ns │ 678.75w │ 0.35w │ 0.35w │ 84.59% │
│ Authentication_ok_int64.parse (string) │ 205.84ns │ 251.00w │ │ │ 4.98% │
│ Authentication_ok_int64.parse (bigstring) │ 146.00ns │ 242.00w │ │ │ 3.53% │
│ Authentication_ok_int_simple.parse (string) │ 183.80ns │ 211.00w │ │ │ 4.45% │
│ Authentication_ok_int_simple.parse (bigstring) │ 122.37ns │ 202.00w │ │ │ 2.96% │
│ Pgx │ 23.40ns │ 22.00w │ │ │ 0.57% │
│ Pgx_async │ 4_134.51ns │ 639.19w │ 0.29w │ 0.29w │ 100.00% │
└─────────────────────────────────────────────────────────┴────────────┴─────────┴──────────┴──────────┴────────────┘
I'll clean this up and put up a basic repo sometime soon.
from pgx.
I started working on this here: https://github.com/brendanlong/ocaml-postgres-protocol
from pgx.
Related Issues (20)
- Module name clash HOT 1
- Support connection service file HOT 1
- Remove Pgx_async_test from the public API
- Pgx_eof errors are hard to debug HOT 1
- Support TLS encryption HOT 4
- Support TLS for Pgx_lwt_unix
- Support PG* environment variables for TLS configuration HOT 1
- Nested Transactions
- More guards around transactions
- Server hangs up during authentication HOT 5
- Support SASL and SCRAM-SHA-256
- Any ORM suite for OCaml , working with pgx together?
- Use BINARY mode for results HOT 1
- Wrong clause number in LGPL special exception
- Deprecated `Stream` module HOT 1
- unix_domain_socket_dir HOT 1
- Add Date and Time Pgx.Values for Lwt backend HOT 4
- Run dune-release lint in CI HOT 1
- Build in CI with `-p` argument HOT 1
- Add Pgx_value_ptime with ptime converters HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pgx.