README: let's talk about speed up.

master
Philippe PITTOLI 2024-05-05 01:03:27 +02:00
parent 197af64c83
commit 0cfb5146f3
1 changed files with 6 additions and 5 deletions

View File

@ -1,4 +1,3 @@
# dodb.cr
DODB stands for Document Oriented DataBase.
@ -31,7 +30,7 @@ FYI, in my projects the database is fast enough so I don't even need parallelism
*Durability* is taken into account.
Data is written on-disk each time it changes.
**NOTE**: what I need is mostly there.
**NOTE:** what I need is mostly there.
What DODB doesn't provide, I hack it in a few lines in my app.
DODB will provide some form of atomicity and consistency at some point, but nothing fancy nor too advanced.
The whole point is to keep it simple.
@ -42,10 +41,12 @@ Since DODB doesn't use SQL and doesn't even try to handle stuff like atomicity o
Reading data from disk takes about a few dozen microseconds, and not much more when searching an indexed data.
**On my more-than-decade-old, slow-as-fuck machine**, the simplest possible SQL request to Postgres takes about 100 to 900 microseconds.
To reach a data on-disk: 13 microseconds.
To reach a data that is indexed: same thing, 13 microseconds, since it's just a link.
With DODB, to reach on-disk data: 13 microseconds.
To search then retrieve indexed data: almost the same thing, 16 microseconds on average, since it's just a path to a symlink we have to build.
With the `cached` version of DODB, there is not even deserialization happening, so 7 nanoseconds.
For indexes (indexes, partitions and tags), the speed up *"only"* is about 14 compared to the uncached version, because indexes still walk the file-system.
I may develop fully cached indexes at some point, but keep in mind that this costs memory (but yeah, again, insane speeds).
**NOTE:** of course SQL and DODB cannot be fairly compared based on performance since they don't have the same properties.
But still, this is the kind of speed you can get with the tool.
@ -205,7 +206,7 @@ In our last example we had a `Car` class, we stored its instances in `cars` and
Now, we want to update a car:
```Crystal
# we find a car we want to modify
car = cars_by_id "86a07924-ab3a-4f46-a975-e9803acba22d"
car = cars_by_id.get "86a07924-ab3a-4f46-a975-e9803acba22d"
# we modify it
car.color = "Blue"