In JabRef, we use
CSL.makeAdhocBibliography(style, outputFormat.getFormat(), cslItemData);
to create the HTML-preview for the currently selected item in the BibTeX database. Every time the user scrolls through the main list, we update the preview and call this code again. I have carefully profiled what happens, but everything points to this call being the source of our memory and performance problems. I know that makeAdhocBibliography has a clear warning sign in its comments that it will be expensive.
Can you recommend the best possible way to handle our situation so that it is as resource-friendly as possible? We have the following constants and variables:
- the style is set in the preferences and stays constant most of the time
- the output format is fixed as well
- we provide the
cslItemData every time the preview needs to be updated
I'm asking this question because at the moment I see no sensible way with one of the built-in ItemDataProviders to achieve this. Therefore, one of my first questions would be: Is it OK to make an ItemDataProvider that changes its content? I would then initialize a CSL instance with an empty provider and change its underlying ItemData list every time we need to render an item.
In JabRef, we use
to create the HTML-preview for the currently selected item in the BibTeX database. Every time the user scrolls through the main list, we update the preview and call this code again. I have carefully profiled what happens, but everything points to this call being the source of our memory and performance problems. I know that
makeAdhocBibliographyhas a clear warning sign in its comments that it will be expensive.Can you recommend the best possible way to handle our situation so that it is as resource-friendly as possible? We have the following constants and variables:
cslItemDataevery time the preview needs to be updatedI'm asking this question because at the moment I see no sensible way with one of the built-in
ItemDataProvidersto achieve this. Therefore, one of my first questions would be: Is it OK to make anItemDataProviderthat changes its content? I would then initialize aCSLinstance with an empty provider and change its underlyingItemDatalist every time we need to render an item.