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

Performance #290

Closed
Konstantin8105 opened this issue Oct 30, 2017 · 6 comments
Closed

Performance #290

Konstantin8105 opened this issue Oct 30, 2017 · 6 comments

Comments

@Konstantin8105
Copy link
Contributor

Konstantin8105 commented Oct 30, 2017

In according to tool go tool trace for transpiling file shell.c from sqlite:
screenshot at 2017-10-30 23 12 24

Now, c2go use only one core for transpiling.(on picture more core - it is GC working).

Problem

Need to add concurrency if possible.

@Konstantin8105
Copy link
Contributor Author

For function main.convertLinesToNodes possible.

@Konstantin8105
Copy link
Contributor Author

For regexp : https://github.com/opennota/re2dfa

@elliotchance
Copy link
Owner

This is great information. One of the biggest performance improvements was made by you with caching the regex's. Parallelising convertLinesToNodes would be difficult because it builds a tree.

My first thought is that it would have to be a two stage process:

  1. The tree is built to a very shallow depth (like max 3 nodes deep).
  2. Iterating the leaf nodes and scheduling the rest of the children to be processed on an independent Go routine.

Ideally in a pool since there would be lots of small jobs.

@Konstantin8105
Copy link
Contributor Author

Now, on my laptop:

$ time c2go transpile sqlite3.c
real	1m0.523s
user	1m22.988s
sys	0m2.048s

@Konstantin8105
Copy link
Contributor Author

Function main.convertLinesToNodes easy to parallelize, because it not a tree - it is parsing each element of slice. Now, I check concerrency of that function and time of transpilig going down from 60 sec to 45 sec. Preliminary 25%.
But function main.buildTree is a tree and that function is difficult for parallelization.

@Konstantin8105
Copy link
Contributor Author

After create a parallell covertLinesToNodes:
after

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