-
Notifications
You must be signed in to change notification settings - Fork 102
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
Optimizing related_post_gen benchmark #838
Comments
Why not using post index instead? safe and fast |
I think no implementation does this as it wouldn't produce required result. |
|
what is done above is that JSON is loaded into temp array, which is then moved to heap. that way we get pointers to individual posts and those are safe. then Post? can be stored just about anywhere. i've cleaned up few obvious things. the biggest is array initialization. clear + resize in daScript keeps fields initialized to 0\null\empty string etc. i've also moved topPosts, instead of clonning them. both options can be removed (skip_lock_checks and unsafe_deref). they contribute somewhat, and data can be reorganized to avoid both. This is what I get locally: INTERPRETED: |
@borisbat That gives very good performance boost on my machine. Rules say no unsafe code blocks, so How can I compile AOT? Currently only interpreted mode is included in the benchmark. |
There is tutorial02aot in the examples on how to setup CMAKE project with AOT. |
I'm looking in
So, something like should work, right?
|
U'll need some sort of main.cpp from das, on top of related_aot.cpp. the aot generates custom daScript executable, which is used to run it. CodeOfPolicies aot field should be set to true. |
I'm not sure I understand what I need to do. Is there any chance you could create a PR for building AOT version? |
Okie. Once I have a stopping point I'll make a PR. |
How that “no unsafe” rules applies to c++ then:)? |
Good question. I don't know really. C++ implementation should probably use |
Hi,
I added daScript to the related_post_gen benchmark.
https://github.com/jinyus/related_post_gen/blob/main/dascript/related.das
This is my first time using daScript, so my implementation is probably very far from optimal.
I couldn't find a way to avoid cloning the posts without using the unsafe. This seems to be causing OOM on the test VM. Is there a way to copy a reference or pointer to struct without using unsafe?
The text was updated successfully, but these errors were encountered: