Openbravo Issue Tracking System - POS2
View Issue Details
0053491POS2POSpublic2023-09-19 13:452023-10-31 17:31
normalmajorhave not tried
0053491: Generation of small keymaps is very slow when there are many products in the masterdata
A common use case for clients could be to have many products in the masterdata, but just a few of them as part of the keymap. All products would be scannable an searchable, but only a few of them would be available in the keymap, those that are used more often.

Generating the keymap configuration with those volumes (many products, but very few in keymap) seems to be unnecessarily slow. For instance, the keymap included in pos2 sampledata is taking 0000176:0000040 seconds to be generated.
- Add 100.000 products and configure them to be used in the POS (you can use the attached patch)
- Add some code to measure how long the generation of the keymap takes (see other attached patch)
- Log in. Look for the "Generating the keymap took" message, note that it takes very long.
No tags attached.
Issue History
2023-09-19 13:45AugustoMauchNew Issue
2023-09-19 13:45AugustoMauchAssigned To => Retail
2023-09-19 13:45AugustoMauchTriggers an Emergency Pack => No
2023-09-19 13:45AugustoMauchAssigned ToRetail => AugustoMauch
2023-09-19 13:45AugustoMauchStatusnew => scheduled
2023-09-19 14:48hgbotNote Added: 0154994
2023-10-31 17:31hgbotNote Added: 0156574
2023-10-31 17:31hgbotResolutionopen => fixed
2023-10-31 17:31hgbotStatusscheduled => closed
2023-10-31 17:31hgbotFixed in Version => 24Q1
2023-10-31 17:31hgbotNote Added: 0156575

2023-09-19 14:48   
Merge Request created: [^]
2023-10-31 17:31   
Merge request merged: [^]
2023-10-31 17:31   
Directly closing issue as related merge request is already approved.

Repository: [^]
Changeset: afeb827459f6f1d4ac07e8d35e9b6ec4e9313b5b
Author: Augusto Mauch <>
Date: 31-10-2023 16:31:42
URL: [^]

Fixes ISSUE-53491: Updates two criterias to improve performance of keymap generation

There were two criterias that, the way they were being built, resulted in very slow executions, that went over all the product
records one by one, the criteria then being executed in-memory for all those records.

The updated criterias take advantage of the existing indexes, and only do the in-memory filter after having already extracted
the relevant records using an index of the model.

M web-jspack/org.openbravo.pos2/src/components/KeyMapEditor/steps/KeyMapEditorKeymapsGrid/__test__/KeyMapEditorKeymapsGrid.test.jsx
M web-jspack/org.openbravo.pos2/src/configurations/keymapConfiguration/__test__/getKeymapInformation.test.js
M web-jspack/org.openbravo.pos2/src/configurations/keymapConfiguration/loadKeymapConfigurations.js
M web-jspack/org.openbravo.pos2/src/configurations/keymapConfiguration/utils/getAssortmentProducts.js