Skip to content

Commit 4f52e47

Browse files
This caching doesn’t actually do anything to address perf of the functionality
1 parent 83a460d commit 4f52e47

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

packages/xforms-engine/src/lib/names/QualifiedName.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { UpsertableWeakMap } from '@getodk/common/lib/collections/UpsertableWeakMap.ts';
21
import type { XPathDOMAdapter } from '@getodk/xpath';
32
import { NamespaceURL } from './NamespaceURL.ts';
43

@@ -108,7 +107,6 @@ interface PrefixResolutionOptions {
108107
*/
109108
export class QualifiedName implements DeferredPrefixedQualifiedNameSource {
110109
private readonly defaultPrefixResolutionOptions: PrefixResolutionOptions;
111-
private readonly prefixedNameCache = new UpsertableWeakMap<PrefixResolutionOptions, string>();
112110

113111
readonly namespaceURI: NamespaceURI;
114112

@@ -160,15 +158,13 @@ export class QualifiedName implements DeferredPrefixedQualifiedNameSource {
160158
* in e.g. "debug/form design/dev mode" scenarios.
161159
*/
162160
getPrefixedName(options: PrefixResolutionOptions = this.defaultPrefixResolutionOptions): string {
163-
return this.prefixedNameCache.upsert(options, () => {
164-
const { namespaceURI, localName } = this;
165-
const prefix = options.lookupPrefix(namespaceURI);
161+
const { namespaceURI, localName } = this;
162+
const prefix = options.lookupPrefix(namespaceURI);
166163

167-
if (prefix == null) {
168-
return localName;
169-
}
164+
if (prefix == null) {
165+
return localName;
166+
}
170167

171-
return `${prefix}:${localName}`;
172-
});
168+
return `${prefix}:${localName}`;
173169
}
174170
}

0 commit comments

Comments
 (0)