- It may take a significant time to map now that we are using patterns.
Using a query regex and possibly tow conditions with ignores/excludes is likely to be slow. I think we may end up having multiple full table scans in a loop. This main explain why this pipeline step now runs about 5 to 12 times slower than before. I suggest to invert the processing. Right now, we process here this way: https://github.com/nexB/scancode.io/blob/c29c62884a383ae00cb67f5c1e03166e548e4056/scanpipe/pipes/d2d.py#L856C1-L856C1
- for each ABOUT file
- for each resource matching ABOUT file paths and excludes
- create/update Package
Instead we could do this, ensuring we ever do a single pass on the resources:
- for each ABOUT file
- collect path patterns and translate and compile to regex
- for each resource:
- for each ABOUT file pattern
- if resource matching ABOUT file paths and excludes
- accumulate Resource for a later bulk operation
- .....
- for each mapped ABOUT file:
- create/update Package
- bulk create the Package -> Resources relationships
- for each non-mapped:
- Companion files should be taken from the ABOUT file, not implied based on naming conventions this should be using the ABOUT file content https://github.com/nexB/scancode.io/blob/c29c62884a383ae00cb67f5c1e03166e548e4056/scanpipe/pipes/d2d.py#L859
Using a query regex and possibly tow conditions with ignores/excludes is likely to be slow. I think we may end up having multiple full table scans in a loop. This main explain why this pipeline step now runs about 5 to 12 times slower than before. I suggest to invert the processing. Right now, we process here this way: https://github.com/nexB/scancode.io/blob/c29c62884a383ae00cb67f5c1e03166e548e4056/scanpipe/pipes/d2d.py#L856C1-L856C1
Instead we could do this, ensuring we ever do a single pass on the resources: