-
Notifications
You must be signed in to change notification settings - Fork 36
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
Precompile go file, write function created wrong #35
Comments
|
@Joker I am a co-worker of @miachel-lv We are evaluating Jade/Golang for a large project and thus far we a perplexed at the randomless of how some templates are using optimized WriteXXX methods versus the default but very slow WriteAll. So our question:
Thanks for all the help. We are willing to assist in helping make this pkg better since we really like the Jade template language. |
Look at the https://github.com/SlinSo/goTemplateBenchmark/blob/master/jade/simple.jade
and generated https://github.com/SlinSo/goTemplateBenchmark/blob/master/jade/simple.jade.go
Model:
It is able to import a go struct with a simple String type field and Jade parser was able to detect the native String type and use WriteEscString() instead of WriteAll(str, true). I don't understand how that example is different in the one provided by @miachel-lv which failed struct native type detection. |
Thanks a lot, your question helped me to find a bug which occurred due to new Go version. |
@Joker Awesome. |
This is model file:
![截屏2020-05-02下午7 40 00](https://user-images.githubusercontent.com/13671739/80863145-cd02d580-8cac-11ea-8a05-0b1bfd209652.png)
This is my jade file:
after do precompiled to go file:
![截屏2020-05-02下午7 34 04](https://user-images.githubusercontent.com/13671739/80863034-eeaf8d00-8cab-11ea-9add-5d220069bbb7.png)
I don't understand why in function 'Simple' loop, StroyId UserId are call 'WriteAll' function write to buffer, and why not call 'WriteUint' function write to buffer.
The jade command I executed: ./jade index.jade
my project tree:
![截屏2020-05-02下午7 44 07](https://user-images.githubusercontent.com/13671739/80863234-70ec8100-8cad-11ea-8a85-12ea3f1fa865.png)
Hope you can reply me, thanks!
The text was updated successfully, but these errors were encountered: