vulnerablecode icon indicating copy to clipboard operation
vulnerablecode copied to clipboard

Replace paginated with iterator

Open kunalsz opened this issue 8 months ago • 3 comments

In reference to the issue #1798

  • Replaced the custom paginated by using the inbuilt .iterator() method
  • Also removed the paginated method from the BaseQuerySet

@keshav-space Looking forward to your insights

kunalsz avatar Apr 02 '25 10:04 kunalsz

@kunalsz Thanks! Did you make any quick measurement before and after to validate that this is more efficient in ram/cpu/number of queries? Would there be a small unit test that could check this?

pombredanne avatar Apr 03 '25 08:04 pombredanne

Hi @pombredanne , I don't know how to test this out like @keshav-space did in the respective issue, if he could share the code/test file which he used to compare both the functions then I'll happily add the test results too.

kunalsz avatar Apr 03 '25 17:04 kunalsz

Hi @pombredanne , I don't know how to test this out like @keshav-space did in the respective issue, if he could share the code/test file which he used to compare both the functions then I'll happily add the test results too.

@kunalsz a very simple way to evaluate the performance would be to start VulnerableCode in Docker and run a large pipeline, like the GitHub importer pipeline, and collect the logs. Do this process twice, once with the old paginated and then with the built-in iterator and compare the logs. Make sure to reset the database between the two runs.

keshav-space avatar Apr 18 '25 09:04 keshav-space