-
Notifications
You must be signed in to change notification settings - Fork 182
Heap & asm instance pooling #155
base: master
Are you sure you want to change the base?
Conversation
Nice work, I'll do my best to get this merged this week! |
Will this get merged? |
ping @alippai |
@alippai Will this get merged? |
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 know this PR has been ignored, but I appreciate the changes.
There are a couple issues at a glance I'm not sure of the resolution, a typing error, and one small syntax error.
(TypeScript 4.0.3)
@@ -13,7 +13,32 @@ export abstract class Hash<T extends sha1result | sha256result | sha512result> { | |||
public BLOCK_SIZE!: number; | |||
public HASH_SIZE!: number; | |||
|
|||
protected static heap_pool !: Array; | |||
protected static asm_pool !: Array; | |||
protected static asm_function!: Function; |
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.
A definite assignment assertion '!' is not permitted in this context.
Generic type 'Array<T>' requires 1 type argument(s).
protected acquire_asm() { | ||
if (this.heap === undefined && this.asm === undefined) { | ||
this.heap = this.constructor.heap_pool.pop() || _heap_init(); | ||
this.asm = this.constructor.asm_pool.pop() || this.constructor.asm_function({ Uint8Array: Uint8Array }, null, this.heap.buffer); |
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.
Property 'heap_pool' does not exist on type 'Function'
Property 'asm_pool' does not exist on type
Property 'asm_function' does not exist on type 'Function'
|
||
protected release_asm() { | ||
this.constructor.heap_pool.push(this.heap)); | ||
this.constructor.asm_pool.push(this.asm); |
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.
Property 'heap_pool' does not exist on type 'Function'
';' expected (extra parenthesis)
Property 'asm_pool' does not exist on type 'Function'
Hey 👋 There is an updated implementation of this, here: openpgpjs@6e5fe3f. If there's interest from the maintainers I'd be happy to update this PR to that; alternatively you can also use that fork in the meantime. |
@alippai any chances that this can get picked back up? |
Fix #154 (Improving Firefox performance). Also, bring back
sha*.bytes()
convenience functions.