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

Output pages in parallel #107

Open
hmenke opened this issue May 23, 2019 · 2 comments
Open

Output pages in parallel #107

hmenke opened this issue May 23, 2019 · 2 comments

Comments

@hmenke
Copy link

hmenke commented May 23, 2019

dvisvgm is pretty slow compared to regular TeX page output. Since it is written in C++11 it could make use of cross-platform multithreading. Would it be possible to output pages in parallel?

@mgieseki
Copy link
Owner

mgieseki commented May 23, 2019

Unfortunately, DVI is a linear format, i.e. several commands that describe or annotate the content of a page may affect preceding and following pages as well. Thus, it's necessary to process the pages sequentially or to scan the entire file in advance. dvisvgm does the latter. I don't see much room for speed optimizations here.
In order to parallelize the actual conversion of the DVI pages, a huge amount of the current code had to be redesigned. I guess that's too big a task for a single developer. At least at the moment I can't estimate when I would have enough time to work on it.

@hmenke
Copy link
Author

hmenke commented Jun 17, 2020

I just looked at this again today and it seems that these loops need to be parallelized:

dvisvgm/src/ImageToSVG.cpp

Lines 139 to 143 in c2a8942

for (const auto &range : ranges) {
convert(range.first, range.second, pageinfo);
if (pageinfo)
pageCount += pageinfo->first;
}

dvisvgm/src/DVIToSVG.cpp

Lines 178 to 179 in c2a8942

for (const auto &range : ranges)
convert(range.first, range.second, hashFunc.get());

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

No branches or pull requests

2 participants