* perf: Reduce penalty for lack of redis connection
If redis isn't running than this client cache is slower than default
implementation because of the extra locking overhead.
* test: update perf redis counts
* perf: cache table columns in client-cache
* fix: race condition on cache-client_cache init
Rare but apparant in synthetic benchmarks.
Cache is set but client cache is still being initialized then request
will fail.
* perf: Don't run notifications when loading document
WHAT?
* fix: use cached doc to repopulate
* perf: reduce get_meta calls
For doctype/user specific cache eviction, no need to remove site_cache.
Rationale:
- Site cache is worker specific, so this eviction doesn't help much.
- Anything that might need to be evicted from site cache should be
manually cleared or use a TTL.
Maybe we can just replace all of site_cache usage with
https://github.com/frappe/frappe/pull/28992 once it's stable.
This is middle ground between caching it completely and requiring a
restart/signal to reload vs always reloading it.
I don't know any use cases that can break from this, nowhere in code
configs should be expected to reload instantly.
This change is only applied to requests for now
There is no gaurantee that setup_cache is only called once. This PR adds
a mutex lock to ensure only one thread gets to create the connection. If
both arrive at same time then one of them will be blocked until
connection is setup.
So far this hasn't been an issue because the "orphan" connection would
just get garbage collected but if you setup any kind of listener on it
or refer to it then it will keep running forever hurting performance.
This just has small performance impact on first request that sets up the
connection, in absence of contention the lock should have almost no
overhead. I make up for it by eliminating one function call :pinch:
Unnecessary overhead and need to disable this everytime I want to get
realistic performance numbers out.
All the performance affecting toggles should be directly controlled by
just `developer_mode` alone.
* perf: resolve rounding method once
When rounding method is explcitly specified it's 1.4x faster.
* perf: reorder checks
Bankers rounding is default and most common now
* perf: speedup get_system_settings
* perf: Reduce impact of forced cache replacement on every doc access
* fix: clear cache before processing users
Note: This is just an artifact of testing model, this won't have any real
effect on execution in real system.
Basically `enqueue_on_commit` is not respected in tests and it can't be
practically supported either.
- Eagerly initialize request_cache, all requests use it, so what is the
point of doing it lazily?
- Reduce accesses to `frappe.local` namespace, get cache once and reuse
it in rest of the execution.
Before: 1250ns +/- 1%
After: 645ns +/- 1%
Source: Trust me bro.
(no really, for now just trust me or look at the diff)
* feat: Add bench layout classes and configuration handler
Bench layout: (`frappe.bench`)
- Layout by env variable, e.g. FRAPPE_BENCH_PATH, FRAPPE_SITES_PATH, etc
- Detecting modules and apps by the presence of a sentinel .frappe file
- Site is scoped by frappe.local.site_name (thread safe)
Config handler: (`frappe.bench.sites{,.site}.config`)
- Optional config registry for better discovery; warning if not specced
- Env variable overload with `FRAPPE_` prefix
* chore: type frappe.config
* chore: type frappe.bencher
* chore: py310 compat
* chore(typing): type filters
* chore(typing): type filters for get_list et al
* fix: dashboard chart filter expression
* test: fix case with new-style right hand object to equality check
* chore: place new typed filter under typing verification
* chore: remove debug print statment
* chore: inverse logic of type guard
* fix: add float to filter value types
* chore: clarify value naming
* test: fix universal type checker based on downstream use and more testing
* fix: type validation error reporting
* fix: types; various
* chore: switch off test-time type checking
still too many errors
* refactor: toml test records for readability
* fix: maintain backwards compatibility
* refactor: transform in-tree records
* chore: don't use deprecated functions (treewide)
* chore: revert migration of tests which depend on old test records list
* feat: add cls.globalTestRecords on IntegrationTestCase
* feat: Add deprecation_dumpster.py file
* docs: add jovial and jocose docstring for frappe/deprecation_dumpster.py
* refactor: fill the dumpster with its own kind
* refactor: move to the deprecation dumpster
* chore: color coding class
* fix: only check import error when import errors
* feat: set doctype on test classes
* refactor: Transform `make_test_records` into a generator
* feat: lazy create doctype records on first use
* perf: improve file walker
* fix: submission queue test
* refactor: improve logging a bit
* fix: global records install for app (semifix)