Commit Graph
20 Commits
Author SHA1 Message Date
Raphael Collet ba25420312 [REF] tests: decorators and method to count queries (#21499)
Add the context manager method `assertQueryCount` to count queries,
the decorator `@users(...)` to execute a test for several users, and
the decorator `@warmup` to execute a test twice (warm-up, then real).
2017-12-12 15:52:35 +01:00
Thibault Delavallée 010add2903 [FIX] test_(performance/mail): better use test_performance in test_mail and update counters
Containing

 * fix self._round not always existing;
 * fix counter for activity creation;
 * use self.str() in order to have some variation in test_mail;
 * separate base performance to mail feature specific performance tests;
2017-12-06 11:33:10 +01:00
Thibault Delavallée 22cce3be9d [ADD] test_mail: add some performances tests 2017-11-29 10:11:15 +01:00
Thibault Delavallée 1cc1ef5058 [SPLIT] test_performance: split between base and mail performance tests
Test performance will now hold the base class for performance tests as
well as tests related to the ORM, depending only on base. A new module
test_mail is introduced at this commit that contains performance tests
related to mail module. This commit contains only code move and should
not impact anything.

Future commits will move mail tests into test_mail so that all mail
related tests are located in the same optional module. This allows
notably to avoid creating a lot of unnecessary tables when installing
mail module on production databases.
2017-11-29 10:05:01 +01:00
Christophe Simonis 26257ad7a1 [FIX] test_performance: bump query count
When `rating` is installed, a few more queries are executed...
2017-11-09 20:35:54 +01:00
Christophe Simonis e74ef6cfb9 [FIX] test_performance: bump query count
Recent changes in tracking fields add a new query. Adapt tests.
2017-11-09 19:44:38 +01:00
Raphael Collet a16c44210a [FIX] models: skip an SQL query when its result is known to be empty
In method `search`, simply make an abstract interpretation of the domain to
determine whether it is equivalent to false.  In that case, skip the query.
2017-09-29 16:14:57 +02:00
Raphael Collet 36141931bf [FIX] mail: remove field res_model_id for performance reasons (#19744) 2017-09-27 16:58:19 +02:00
Raphael Collet b4824d78eb [FIX] mail: avoid re-reading a value given to create
After a message is created with a given `author_id`, reuse `author_id` instead
of `message.author_id.id`.
2017-09-26 09:32:54 +02:00
Raphael Collet 3ca6392a3f [FIX] mail: simplify ormcache parameters to avoid queries
Make the cache depend on `user` instead of `user.groups_id`.
This saves 2 queries on each write/create of `mail.thread`.
2017-09-26 09:32:54 +02:00
Raphael Collet c6b184bb23 [FIX] fields: optimize many2many command (6, 0, ids) on new records
The command does not need to remove existing relations, as there is no relation
yet on new records.  This saves one query per many2many field with that command
in a `create`.
2017-09-21 16:10:13 +02:00
Raphael Collet 59a8234fbc [FIX] mail performance: avoid useless queries
Avoid making queries that are known to return empty recordsets, and do not
format messages to be notified on no channel.
2017-09-21 16:10:13 +02:00
Raphael Collet 69161ed69c [FIX] mail: performance, replace filter() by condition in domain 2017-09-20 13:30:56 +02:00
Raphael Collet 49f6a1b544 [FIX] fields: improve performance of many2many fields
An update by a list of commands is now guaranteed to have at most three SQL
queries to update the relation, whatever the number of commands and records.
2017-09-20 13:30:56 +02:00
Raphael Collet 87970ea344 [FIX] mail: add cached method to retrieve message subtypes
This saves queries to retrieve message subtypes for a given model.
2017-09-20 13:30:56 +02:00
Raphael Collet 38193456d4 [FIX] test_performance: log when number of queries is less than expected 2017-09-20 13:30:56 +02:00
Raphael Collet ed9e3ed699 [IMP] test_performance: run tests as demo user as well 2017-09-12 17:16:24 +02:00
Raphael Collet ee14025c52 [REF] test_performance: improve cache warmup in test methods 2017-09-12 17:16:24 +02:00
Raphael Collet d7190a3fd0 [IMP] api: reindex the record cache to improve cache hit
The record cache is indexed by `(field, record_id, key)`, where `key` depends
on the environment.  The key is either `(cr, uid, context)` or `(cr, uid)`,
depending on whether the field's value is context-dependent.  As most fields
are not context-dependent, this should avoid some cache prefetching when
swiching context.
2017-09-08 13:21:00 +02:00
Raphael Collet 81192d66d9 [ADD] test_performance: check the performance of CRUD operations 2017-09-06 16:05:10 +02:00