ree 1.3.4 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +22 -0
- data/lib/ree/templates/init/ree.setup.rb +3 -0
- data/lib/ree/version.rb +1 -1
- data/lib/ree.rb +17 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 452953a21318a446a47364d8bc043f9fdbc2d8bfd85731714f6b10eeb1f553da
|
|
4
|
+
data.tar.gz: 3326d95a0384bed8a496de402d0ef7e2f126546976e7cc321dc2bb8b7bd0ffb4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6350771b8847969833e106028195c609130b3476ccd9ab84701a84fb27401737ae57e1aee130d0c05ef04f3caf1cc34371f70b05220d5878c009b8760b907c07
|
|
7
|
+
data.tar.gz: 6e8c7039300062b1f470fc5d6f7d026f2bc6a66302109364ec6185915659371e661b02e05d45418191bd2d51402f57f5df9d219d48093b6d8eb20f9185ff8fdc
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -449,6 +449,28 @@ end
|
|
|
449
449
|
### Disabling contracts
|
|
450
450
|
If you want to disable contracts, set the `NO_CONTRACTS` environment variable. This will disable contracts and you won't have a performance hit.
|
|
451
451
|
|
|
452
|
+
### DB load performance mode
|
|
453
|
+
Read models that load many rows pay for casting every column through the
|
|
454
|
+
mapper even though the DB driver already returns correctly typed values.
|
|
455
|
+
Enable the mode in `ree.setup.rb` (before any DAO or mapper is loaded):
|
|
456
|
+
|
|
457
|
+
```ruby
|
|
458
|
+
if ENV['RUBY_ENV'] == 'production'
|
|
459
|
+
Ree.enable_db_load_performance_mode
|
|
460
|
+
end
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
Mappers built while the mode is on compile a specialized `db_load` method:
|
|
464
|
+
primitive fields (`integer`, `string`, `bool`, `float`, `date`, `time`,
|
|
465
|
+
`date_time`, `rational`, `any`) skip casting behind a single type-guard
|
|
466
|
+
check, and dto construction avoids intermediate allocations. Values that
|
|
467
|
+
fail the guard (e.g. a date stored as a string inside `pg_jsonb`, or a
|
|
468
|
+
`BigDecimal` from a `numeric` column mapped to `float`) are cast exactly as
|
|
469
|
+
before, so results and errors are identical to the normal mode. Custom
|
|
470
|
+
types, enums, `pg_array`/`pg_jsonb` and nested mappers are always cast.
|
|
471
|
+
Calls with `role:`/`only:`/`except:` fall back to the generic
|
|
472
|
+
implementation. Running production under YJIT compounds the gain.
|
|
473
|
+
|
|
452
474
|
## Ree Schemas
|
|
453
475
|
Coming soon...
|
|
454
476
|
|
data/lib/ree/version.rb
CHANGED
data/lib/ree.rb
CHANGED
|
@@ -148,6 +148,23 @@ module Ree
|
|
|
148
148
|
!!@hide_internal_swagger_endpoints
|
|
149
149
|
end
|
|
150
150
|
|
|
151
|
+
# Mappers built while this mode is on compile a specialized :db_load
|
|
152
|
+
# method that trusts DB values already typecast by the driver: primitive
|
|
153
|
+
# fields skip casting behind a cheap type guard, and dto construction
|
|
154
|
+
# avoids intermediate allocations. Read at mapper build time, so enable
|
|
155
|
+
# it in ree.setup.rb before any DAO/mapper is loaded.
|
|
156
|
+
def enable_db_load_performance_mode
|
|
157
|
+
@db_load_performance_mode = true
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def disable_db_load_performance_mode
|
|
161
|
+
@db_load_performance_mode = false
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def db_load_performance_mode?
|
|
165
|
+
!!@db_load_performance_mode
|
|
166
|
+
end
|
|
167
|
+
|
|
151
168
|
def obfuscated?
|
|
152
169
|
ENV.has_key?('REE_LICENSE_KEY')
|
|
153
170
|
end
|