Sagar Vora
2a2700970d
perf: pre-create UnionType objects
2025-03-20 21:34:07 +05:30
Raffael Meyer
9430e3af86
fix: respect override_whitelisted_method in map_docs ( #31718 )
...
* refactor: override_whitelisted_method
* fix: respect `override_whitelisted_method` in `map_docs`
* refactor: override_whitelisted_method
2025-03-17 14:27:12 +01:00
gavin
554c76aa13
Merge pull request #31706 from gavindsouza/fix-add_viewed
...
refactor: doc.add_viewed
2025-03-17 09:07:47 +01:00
Sagar Vora
36b2d47c14
Merge pull request #31750 from sagarvora/perf-as_dict-
...
perf: reduce repeated attribute access in `as_dict`
2025-03-17 09:26:01 +05:30
Sagar Vora
2414647964
perf: reduce repeated attribute access in as_dict
2025-03-17 09:15:55 +05:30
Sagar Vora
c7a037c3e4
perf: doc.permitted_fieldnames is now a set
2025-03-17 09:02:25 +05:30
Sagar Vora
6ca6e2aebd
perf: improve get_permitted_fields logic
2025-03-17 08:55:32 +05:30
Sagar Vora
628ddfd494
perf: remove repeated calls to get_permitted_fieldnames
2025-03-16 23:39:46 +05:30
Sagar Vora
d50fdbe3bc
perf: much faster doc.update
2025-03-16 13:58:45 +05:30
Sagar Vora
1da2706578
fix: allow user-defined __new__
2025-03-16 11:13:01 +05:30
Ankush Menat
3bfc9fa8da
perf: Don't update list view settings on every query ( #31743 )
...
It literally doesn't do anything ever.
User settings are explicitly updated using `user_settings.save` endpoint.
2025-03-16 05:35:39 +00:00
Sagar Vora
32ff002c32
fix: revert valid columns cache
...
it is used only once when initialising doc
2025-03-16 01:10:29 +05:30
Sagar Vora
63f2c35290
perf: preset _table_fieldnames for child docs
2025-03-16 00:59:10 +05:30
Sagar Vora
09d0abcb54
fix: simplify load_from_db logic
2025-03-15 16:14:55 +05:30
Sabu Siyad
e012213ca2
docs: base_document: remove(): comment to docstring ( #31720 )
2025-03-14 16:30:12 +01:00
Gavin D'souza
dc807832fe
refactor: doc.add_viewed
...
* Don't check for unique_views if not needed - one less query/table scan
* Remove unnecessary indents
* Fix docstring
2025-03-13 11:11:47 +01:00
Ankush Menat
357b6fb11a
perf: don't parse comments just to get comment count ( #28921 )
...
This parsing isn't necessary and we are copying all of _comments just to count
how many there are.
Imagine 2500 documents w/ 1-2 auto generated comments each.
2025-03-13 05:00:21 +00:00
Akhil Narang
bada8cabcb
fix(db_query): improve regex
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-03-07 16:57:27 +05:30
Akhil Narang
3c01bf3d5c
fix: check properly for blacklisted function usage
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-03-05 14:17:39 +05:30
Sagar Vora
146d50e5d4
chore: fix typo in new DocStatus constant
2025-03-05 08:29:47 +05:30
Sagar Vora
ffba20a160
perf: faster _init_child
2025-02-25 14:01:09 +05:30
Sagar Vora
aae5860efc
perf: faster init_valid_columns
2025-02-25 13:20:35 +05:30
Ankush Menat
7721fdb054
fix: clear cache using client_cache ( #31420 )
...
It's faster than relying on indirect invalidations. This was avoided
before only because delete_keys didn't exist on client_cache.
2025-02-25 06:43:39 +00:00
Sagar Vora
c31cb69d5c
fix: update reserved keywords
2025-02-25 12:00:51 +05:30
Sagar Vora
99574a74e2
Merge pull request #31400 from sagarvora/better-table-fieldnames
2025-02-25 10:43:29 +05:30
Ankush Menat
efee329adf
fix: Unlock old locks automatically ( #31411 )
2025-02-24 13:49:08 +00:00
Sagar Vora
26b5d8de15
perf: better _table_fieldnames cache
2025-02-24 17:41:00 +05:30
Sagar Vora
a811aecbc2
Merge pull request #31395 from sagarvora/no-new-weakref
2025-02-24 16:16:14 +05:30
Ankush Menat
dd44b3dba6
perf: cast int-link field filters to string ( #31396 )
...
Comparing varchar field with ints makes indexes unusable in MariaDB.
This PR is just one small fix for DB query, similar fixes won't be made
for DB APIs which do not assume anything about database schema.
2025-02-24 10:39:55 +00:00
Sagar Vora
fc7202ade4
perf: dont create a new weakref.ref for each child
2025-02-24 15:57:42 +05:30
Sagar Vora
b381cc4874
Merge branch 'develop' into ref-docstatus
2025-02-24 15:22:06 +05:30
Sagar Vora
be5e856dd9
Merge pull request #31391 from sagarvora/perf-nosingledispatchmethod
2025-02-24 15:21:05 +05:30
Sagar Vora
bb1080dfac
perf: dont use singledispatchmethod
2025-02-24 15:11:14 +05:30
Sagar Vora
fcf657ba80
perf: improved DocStatus API and other minor improvements
2025-02-24 12:51:10 +05:30
Ankush Menat
37da1d43bd
fix: remove duplicate clear_cache calls ( #31374 )
...
This is internally handled in clear_document_cache
Fix was only required for websitegenerator specific things.
2025-02-21 08:54:05 +00:00
Sagar Vora
6ef67c7a38
Merge pull request #31357 from sagarvora/reqd-fields-only
2025-02-20 17:57:29 +05:30
Sagar Vora
ece9b6396d
perf: get reqd fields only
2025-02-20 17:47:35 +05:30
Sagar Vora
2f9f659fcb
perf(DX): always cache controllers
2025-02-20 17:43:12 +05:30
Ankush Menat
4997e5d223
fix: clear cache after db transaction ends ( #31315 )
...
This reduces probability of stale cache, but it's still very easily
possible because of repeatable read (!)
2025-02-19 11:44:37 +00:00
Sagar Vora
f4062b4d7a
fix: ensure consistent error in response
2025-02-19 12:10:59 +05:30
Ankush Menat
7f0394bf86
fix: short-circuit large table checks ( #31223 )
...
This can become super slow on child tables, so first check if it's worth "checking" data.
2025-02-11 10:09:29 +00:00
Ankush Menat
ef3b0ef008
perf: Only filter last 3 months of data by default on large tables ( #31216 )
...
Applying something basic like `order id like xyz` filter can result in
full table scan on years of data. This isn't necessary most of the time.
Interactive queries are usually done on recent data, so add this filter
to ensure only recent data is checked first.
Users can remove this filter if they want to.
2025-02-11 09:24:08 +00:00
Akhil Narang
8a758365eb
Revert "Merge pull request #28363 from frappe/expr-series" ( #31202 )
...
This reverts commit 91d553c9cf , reversing
changes made to d17136cd04 .
2025-02-10 06:46:45 +00:00
Sandeep Kakde
165968714d
fix: update cache key for table_columns to new format ( #31179 )
2025-02-07 17:19:02 +05:30
Ankush Menat
e3ce05b57e
perf: use client cache for notifications ( #31094 )
2025-02-04 09:24:30 +00:00
Ankush Menat
8eafe67805
feat: share table size heuristic with meta
2025-02-03 09:29:31 +05:30
Ankush Menat
9b79dfeb7b
perf: "random" naming to improve concurrency and locality ( #30053 )
...
This feels overengineered and it kinda is, but other efforts to
inroduce sequential naming/UUID naming haven't been that fruitful
either.
10 character random "hash" i now changed to.
1. first character - last character in UUID4 ID of request/job
2. three characters - derived from current timestamp.
4. 6 characters - random data.
This satisfies all three requirements:
1. Readers - temporal locality should result in spatial locality on disk. (fewer pages accessed)
2. Single writer - temporal locality should result in spatial locality. (fewer dirty pages)
3. Multiple writers - temporal locality should NOT result in spatial locality. (less lock contention)
Mostly concludes https://github.com/frappe/frappe/pull/25309 and https://github.com/frappe/frappe/pull/28349
Rough probabiliy numbers
Assumptions:
- Unique per worker prefix - 16 (uuid's base16 version)
- Rough time spent generating names - 10% of request (very very conservative estimate)
Probability(collision) = P(at least one prefix collision) * P(time collision)
Probability(collision) = (1 - p(all different)) * 10%
Probability(collision) = (1 - (16! / 16-N! )/ 16^N ) * 10%
| N (concurrency) | Probability(collision) |
| 1 | 0.0% |
| 2 | 0.6% |
| 3 | 1.8% |
| 4 | 3.3% |
| 5 | 5.0% |
| 6 | 6.6% |
| 7 | 7.9% |
| 8 | 8.8% |
2025-01-25 07:04:09 +00:00
barredterra
015c9425ed
Revert "fix: don't skip perm check when Apply Strict User Permissions is enabled ( #29916 )"
...
This reverts commit 4a0ccf6d76 .
2025-01-24 19:56:44 +01:00
Raffael Meyer
4a0ccf6d76
fix: don't skip perm check when Apply Strict User Permissions is enabled ( #29916 )
2025-01-24 14:43:46 +05:30
Ankush Menat
4e4972fe2d
refactor: Use @cached_property ( #29212 )
2025-01-17 06:09:05 +00:00