-
Notifications
You must be signed in to change notification settings - Fork 7
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
fix: perf, revert array, shift #10
Conversation
src/rabin.js
Outdated
const cleanArr = [] | ||
for (let i = 0; i < processed.length; i++) { | ||
if(processed[i] === 0) break | ||
cleanArr[i] = processed[i]; | ||
} | ||
|
||
return cleanArr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const cleanArr = [] | |
for (let i = 0; i < processed.length; i++) { | |
if(processed[i] === 0) break | |
cleanArr[i] = processed[i]; | |
} | |
return cleanArr | |
const end = processed.indexOf(0); | |
return end >= 0 ? processed.subarray(0, end) : processed; |
src/rabin.js
Outdated
__release(lengthsPtr) | ||
__release(pointer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better swap this. So alloc and release will be in LIFO order.
__release(lengthsPtr) | |
__release(pointer) | |
__free(pointer) | |
__free(lengthsPtr) |
Because currently used stub
runtime, not full
or half
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed to full, why __free what's the difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this described in docs: https://docs.assemblyscript.org/details/runtime#runtime-variants
in short full
/ half
use RC/GC runtime, stub
/none
just manual memory managment and retain / release
just stubs in this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Read that already I just can't find the __free function, I would prefer to use stub and manage memory manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With full you still need to tell wasm to __retain and after __release so it's kinda manual.
Any docs on how to go full manual with stub/none runtime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With full you still need to tell wasm to __retain and after __release
It's only for js / host side because we can't handle in this case memory automatically. But internally (in AS) you don't need call release / retain because compiler do this by himself (same as in Swift which used ARC)
Array has slightly different layout and require |
/cc @MaxGraey
do you have any idea why the Array version doesn't work?
also i can't find any docs in the @inline decorators were they removed ?