i need to generate excel with large amount of duplicated strings using apache POI, but it not seems to be optimized for this situation, so how it's possible to generate excel efficiently somehow to reuse memory for duplicated strings?
Asked
Active
Viewed 237 times
1
-
4It is not really clear what strings you mean. – Grzegorz Górkiewicz Apr 23 '17 at 20:38
2 Answers
2
With Java 8 you could enable string deduplication (-XX:+UseStringDeduplication), see String Deduplication feature of Java 8 for more details. That reduces the footprint for all duplicated strings, even those created without intern.
1
In terms of heap memory, if strings are getting created using intern()
then work is almost done.
The goal of implementing a single string table that is shared across the workbook is to improve performance in opening and saving the file by only reading and writing the repetitive information once.
But as you said there are lot of similar strings getting used in your POI excel file, then you can use SharedStringsTable concept for effective utilization. See here SharedStringsTable_Ex1 & SharedStringsTable _Ex2

Gal Dreiman
- 3,969
- 2
- 21
- 40

Gurpreet Singh
- 380
- 4
- 9