Skip to content

Commit

Permalink
$mol_wire: reduce str mem
Browse files Browse the repository at this point in the history
  • Loading branch information
jin committed Oct 2, 2024
1 parent 79c419d commit f575a37
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions wire/atom/atom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace $ {
if( existen ) return existen

const prefix = (host as any)?.[ Symbol.toStringTag ] ?? ( host instanceof Function ? $$.$mol_func_name( host ) : host )
const key = `${ prefix }.${ field }`
const key = prefix + ( '.' + field )

const fiber = new $mol_wire_atom( key, task, host, [] as any as Args )
;( host as any ?? task )[ field ] = fiber
Expand Down Expand Up @@ -52,7 +52,7 @@ namespace $ {
dict = ( host as any ?? task )[ field ] = new Map<any,any>()
}

const id = `${ prefix }.${ task.name }<${ key_str.replace( /^"|"$/g, "'" ) }>`
const id = prefix + ( '.' + task.name ) + ( '<' + key_str.replace( /^"|"$/g, "'" ) + '>' )
const fiber = new $mol_wire_atom( id, task, host, [ key ] as any as Args )
dict.set( key_str, fiber )

Expand Down
3 changes: 2 additions & 1 deletion wire/task/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ namespace $ {
return existen
}

const next = new $mol_wire_task( `${ (host as any)?.[ Symbol.toStringTag ] ?? host }.${ task.name }<#>`, task, host, args )
const key = ( (host as any)?.[ Symbol.toStringTag ] ?? host ) + ( '.' + task.name + '<#>' )
const next = new $mol_wire_task( key, task, host, args )

// Disabled because non-idempotency is required for try-catch
if( existen?.temp ) {
Expand Down

0 comments on commit f575a37

Please sign in to comment.