Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Heap & asm instance pooling #155

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

twiss
Copy link
Contributor

@twiss twiss commented Jul 30, 2018

Fix #154 (Improving Firefox performance). Also, bring back sha*.bytes() convenience functions.

@alippai
Copy link
Member

alippai commented Aug 1, 2018

Nice work, I'll do my best to get this merged this week!

@Ruffio
Copy link

Ruffio commented Nov 3, 2018

Will this get merged?

@sanjanarajan
Copy link
Collaborator

ping @alippai

@Ruffio
Copy link

Ruffio commented Jan 17, 2019

@alippai Will this get merged?

Copy link

@TheUltDev TheUltDev left a 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;

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);

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);

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'

@twiss
Copy link
Contributor Author

twiss commented Feb 4, 2021

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.

@dkg
Copy link

dkg commented Oct 26, 2022

@alippai any chances that this can get picked back up?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improving Firefox performance: heap+asm pooling
6 participants