Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change API to use Text rather than String for readers/writers #3731

Closed
jgm opened this issue Jun 10, 2017 · 4 comments
Closed

Change API to use Text rather than String for readers/writers #3731

jgm opened this issue Jun 10, 2017 · 4 comments
Labels
Milestone

Comments

@jgm
Copy link
Owner

jgm commented Jun 10, 2017

This can be done without changing the representation of strings in the Pandoc data structure to Text.
(That should be done too eventually, but this change is independent of that.)

Note that in the readers, we can convert to String and use existing parsers; once the API change is made, we can change the internals to use Text at our leisure.

In the writers, too, we can just do a conversion at first, and change internals later.

But while we're making big changes in the pandoc API, it makes sense to make this one.

@jgm jgm added the API label Jun 10, 2017
@jgm jgm added this to the pandoc 2.0 milestone Jun 10, 2017
@jgm
Copy link
Owner Author

jgm commented Jun 10, 2017

Finished for the readers as of commit 86282d6

Still TODO: writers.

@jgm jgm closed this as completed in fa719d0 Jun 10, 2017
@jgm
Copy link
Owner Author

jgm commented Jun 11, 2017

Note that this change by itself doesn't help with memory usage:

new (on MANUAL.txt):

<<ghc: 1803307032 bytes, 3470 GCs, 6223440/21780264 avg/max bytes residency (22 samples), 61M in use, 0.000 INIT (0.003 elapsed), 0.655 MUT (0.723 elapsed), 0.450 GC (0.584 elapsed) :ghc>>

old:

<<ghc: 1777928296 bytes, 3424 GCs, 6598984/20726176 avg/max bytes residency (22 samples), 60M in use, 0.000 INIT (0.002 elapsed), 0.657 MUT (0.722 elapsed), 0.469 GC (0.608 elapsed) :ghc>>

This is no doubt because most of the memory use is from the parsers, and we're just converting the Text to a String and parsing as before. The improvement will come after we rewrite the parsers to use Text internally.

@tarleb
Copy link
Collaborator

tarleb commented Jun 13, 2017

Heretical question: Would it make sense to use the String type from foundation instead of Text? I don't know much about it but have heard good things. It's UTF-8 internally, while Text uses UTF-16. This could help with memory consumption and would avoid the UTF-8 → UTF-16 conversion performance penalty.

@jgm
Copy link
Owner Author

jgm commented Jun 13, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants