zysszy / GrammarCNN

A CNN model for code generation.
MIT License
95 stars 30 forks source link

Predicting seem slow #6

Open oney opened 5 years ago

oney commented 5 years ago

I have run python3 run.py train ..., and when I run python3 run.py pre, it's slow to generate codes for a card. It takes about 5-10 minutes for a card.

work begin
search level is 0
..... many times
1th card is finished

Is it normal? I'm assuming that if this can apply to real world applications, it should take less than 3 seconds. Is it possible to make it faster?

zysszy commented 5 years ago

Thanks for your attention~

Sorry for the cost of prediction.

The main cost while predicting here is that our implementation of apply rules to AST is written in Java. We have to call the .jar each time when applying a rule. It is not fast, since it takes a lot of time starting JVM and running Java.

In fact, it is possible to make it faster. Change the Java into Python~ Then, it can be a really fast program. This is what we have done in another similar program (not in Github).

oney commented 5 years ago

Really appreciate it! May I ask you why some works need to be done in Java? And can we get the source codes of transfer_ast.jar?

zysszy commented 5 years ago

In fact, writing code in Java is just an accident here. The source code of transfer_ast.jar can get by decompiling it. This is also contained in preprocessing code. If you want to get the code, please feel free to contact me (szy_@pku.edu.cn) Thanks~