use criterion::{BenchmarkId, Criterion, black_box, criterion_group, criterion_main};
use std::collections::HashSet;
#[derive(Copy, Clone, PartialEq, Eq)]
pub(crate) enum PureGlobalIdentifierValue {
NaN,
Infinity,
StrictUndefined,
Other,
}
include!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/../../build/debug/codegen/defines_table_generated.rs"
));
pub(crate) static PURE_GLOBAL_IDENTIFIER_MAP: phf::Map<&'static [u8], PureGlobalIdentifierValue> = phf::phf_map! {
b"NaN" => PureGlobalIdentifierValue::NaN,
b"Infinity" => PureGlobalIdentifierValue::Infinity,
b"undefined" => PureGlobalIdentifierValue::StrictUndefined,
b"Array" => PureGlobalIdentifierValue::Other,
b"Boolean" => PureGlobalIdentifierValue::Other,
b"Function" => PureGlobalIdentifierValue::Other,
b"Math" => PureGlobalIdentifierValue::Other,
b"Number" => PureGlobalIdentifierValue::Other,
b"Object" => PureGlobalIdentifierValue::Other,
b"RegExp" => PureGlobalIdentifierValue::Other,
b"String" => PureGlobalIdentifierValue::Other,
b"AbortController" => PureGlobalIdentifierValue::Other,
b"AbortSignal" => PureGlobalIdentifierValue::Other,
b"AggregateError" => PureGlobalIdentifierValue::Other,
b"ArrayBuffer" => PureGlobalIdentifierValue::Other,
b"BigInt" => PureGlobalIdentifierValue::Other,
b"DataView" => PureGlobalIdentifierValue::Other,
b"Date" => PureGlobalIdentifierValue::Other,
b"Error" => PureGlobalIdentifierValue::Other,
b"EvalError" => PureGlobalIdentifierValue::Other,
b"Event" => PureGlobalIdentifierValue::Other,
b"EventTarget" => PureGlobalIdentifierValue::Other,
b"Float16Array" => PureGlobalIdentifierValue::Other,
b"Float32Array" => PureGlobalIdentifierValue::Other,
b"Float64Array" => PureGlobalIdentifierValue::Other,
b"Int16Array" => PureGlobalIdentifierValue::Other,
b"Int32Array" => PureGlobalIdentifierValue::Other,
b"Int8Array" => PureGlobalIdentifierValue::Other,
b"Intl" => PureGlobalIdentifierValue::Other,
b"JSON" => PureGlobalIdentifierValue::Other,
b"Map" => PureGlobalIdentifierValue::Other,
b"MessageChannel" => PureGlobalIdentifierValue::Other,
b"MessageEvent" => PureGlobalIdentifierValue::Other,
b"MessagePort" => PureGlobalIdentifierValue::Other,
b"Promise" => PureGlobalIdentifierValue::Other,
b"Proxy" => PureGlobalIdentifierValue::Other,
b"RangeError" => PureGlobalIdentifierValue::Other,
b"ReferenceError" => PureGlobalIdentifierValue::Other,
b"Reflect" => PureGlobalIdentifierValue::Other,
b"Set" => PureGlobalIdentifierValue::Other,
b"Symbol" => PureGlobalIdentifierValue::Other,
b"SyntaxError" => PureGlobalIdentifierValue::Other,
b"TextDecoder" => PureGlobalIdentifierValue::Other,
b"TextEncoder" => PureGlobalIdentifierValue::Other,
b"TypeError" => PureGlobalIdentifierValue::Other,
b"URIError" => PureGlobalIdentifierValue::Other,
b"URL" => PureGlobalIdentifierValue::Other,
b"URLSearchParams" => PureGlobalIdentifierValue::Other,
b"Uint16Array" => PureGlobalIdentifierValue::Other,
b"Uint32Array" => PureGlobalIdentifierValue::Other,
b"Uint8Array" => PureGlobalIdentifierValue::Other,
b"Uint8ClampedArray" => PureGlobalIdentifierValue::Other,
b"WeakMap" => PureGlobalIdentifierValue::Other,
b"WeakSet" => PureGlobalIdentifierValue::Other,
b"WebAssembly" => PureGlobalIdentifierValue::Other,
b"clearInterval" => PureGlobalIdentifierValue::Other,
b"clearTimeout" => PureGlobalIdentifierValue::Other,
b"console" => PureGlobalIdentifierValue::Other,
b"decodeURI" => PureGlobalIdentifierValue::Other,
b"decodeURIComponent" => PureGlobalIdentifierValue::Other,
b"encodeURI" => PureGlobalIdentifierValue::Other,
b"encodeURIComponent" => PureGlobalIdentifierValue::Other,
b"escape" => PureGlobalIdentifierValue::Other,
b"globalThis" => PureGlobalIdentifierValue::Other,
b"isFinite" => PureGlobalIdentifierValue::Other,
b"isNaN" => PureGlobalIdentifierValue::Other,
b"parseFloat" => PureGlobalIdentifierValue::Other,
b"parseInt" => PureGlobalIdentifierValue::Other,
b"queueMicrotask" => PureGlobalIdentifierValue::Other,
b"setInterval" => PureGlobalIdentifierValue::Other,
b"setTimeout" => PureGlobalIdentifierValue::Other,
b"unescape" => PureGlobalIdentifierValue::Other,
b"CSSAnimation" => PureGlobalIdentifierValue::Other,
b"CSSFontFaceRule" => PureGlobalIdentifierValue::Other,
b"CSSImportRule" => PureGlobalIdentifierValue::Other,
b"CSSKeyframeRule" => PureGlobalIdentifierValue::Other,
b"CSSKeyframesRule" => PureGlobalIdentifierValue::Other,
b"CSSMediaRule" => PureGlobalIdentifierValue::Other,
b"CSSNamespaceRule" => PureGlobalIdentifierValue::Other,
b"CSSPageRule" => PureGlobalIdentifierValue::Other,
b"CSSRule" => PureGlobalIdentifierValue::Other,
b"CSSRuleList" => PureGlobalIdentifierValue::Other,
b"CSSStyleDeclaration" => PureGlobalIdentifierValue::Other,
b"CSSStyleRule" => PureGlobalIdentifierValue::Other,
b"CSSStyleSheet" => PureGlobalIdentifierValue::Other,
b"CSSSupportsRule" => PureGlobalIdentifierValue::Other,
b"CSSTransition" => PureGlobalIdentifierValue::Other,
b"SVGAElement" => PureGlobalIdentifierValue::Other,
b"SVGAngle" => PureGlobalIdentifierValue::Other,
b"SVGAnimateElement" => PureGlobalIdentifierValue::Other,
b"SVGAnimateMotionElement" => PureGlobalIdentifierValue::Other,
b"SVGAnimateTransformElement" => PureGlobalIdentifierValue::Other,
b"SVGAnimatedAngle" => PureGlobalIdentifierValue::Other,
b"SVGAnimatedBoolean" => PureGlobalIdentifierValue::Other,
b"SVGAnimatedEnumeration" => PureGlobalIdentifierValue::Other,
b"SVGAnimatedInteger" => PureGlobalIdentifierValue::Other,
b"SVGAnimatedLength" => PureGlobalIdentifierValue::Other,
b"SVGAnimatedLengthList" => PureGlobalIdentifierValue::Other,
b"SVGAnimatedNumber" => PureGlobalIdentifierValue::Other,
b"SVGAnimatedNumberList" => PureGlobalIdentifierValue::Other,
b"SVGAnimatedPreserveAspectRatio" => PureGlobalIdentifierValue::Other,
b"SVGAnimatedRect" => PureGlobalIdentifierValue::Other,
b"SVGAnimatedString" => PureGlobalIdentifierValue::Other,
b"SVGAnimatedTransformList" => PureGlobalIdentifierValue::Other,
b"SVGAnimationElement" => PureGlobalIdentifierValue::Other,
b"SVGCircleElement" => PureGlobalIdentifierValue::Other,
b"SVGClipPathElement" => PureGlobalIdentifierValue::Other,
b"SVGComponentTransferFunctionElement" => PureGlobalIdentifierValue::Other,
b"SVGDefsElement" => PureGlobalIdentifierValue::Other,
b"SVGDescElement" => PureGlobalIdentifierValue::Other,
b"SVGElement" => PureGlobalIdentifierValue::Other,
b"SVGEllipseElement" => PureGlobalIdentifierValue::Other,
b"SVGFEBlendElement" => PureGlobalIdentifierValue::Other,
b"SVGFEColorMatrixElement" => PureGlobalIdentifierValue::Other,
b"SVGFEComponentTransferElement" => PureGlobalIdentifierValue::Other,
b"SVGFECompositeElement" => PureGlobalIdentifierValue::Other,
b"SVGFEConvolveMatrixElement" => PureGlobalIdentifierValue::Other,
b"SVGFEDiffuseLightingElement" => PureGlobalIdentifierValue::Other,
b"SVGFEDisplacementMapElement" => PureGlobalIdentifierValue::Other,
b"SVGFEDistantLightElement" => PureGlobalIdentifierValue::Other,
b"SVGFEDropShadowElement" => PureGlobalIdentifierValue::Other,
b"SVGFEFloodElement" => PureGlobalIdentifierValue::Other,
b"SVGFEFuncAElement" => PureGlobalIdentifierValue::Other,
b"SVGFEFuncBElement" => PureGlobalIdentifierValue::Other,
b"SVGFEFuncGElement" => PureGlobalIdentifierValue::Other,
b"SVGFEFuncRElement" => PureGlobalIdentifierValue::Other,
b"SVGFEGaussianBlurElement" => PureGlobalIdentifierValue::Other,
b"SVGFEImageElement" => PureGlobalIdentifierValue::Other,
b"SVGFEMergeElement" => PureGlobalIdentifierValue::Other,
b"SVGFEMergeNodeElement" => PureGlobalIdentifierValue::Other,
b"SVGFEMorphologyElement" => PureGlobalIdentifierValue::Other,
b"SVGFEOffsetElement" => PureGlobalIdentifierValue::Other,
b"SVGFEPointLightElement" => PureGlobalIdentifierValue::Other,
b"SVGFESpecularLightingElement" => PureGlobalIdentifierValue::Other,
b"SVGFESpotLightElement" => PureGlobalIdentifierValue::Other,
b"SVGFETileElement" => PureGlobalIdentifierValue::Other,
b"SVGFETurbulenceElement" => PureGlobalIdentifierValue::Other,
b"SVGFilterElement" => PureGlobalIdentifierValue::Other,
b"SVGForeignObjectElement" => PureGlobalIdentifierValue::Other,
b"SVGGElement" => PureGlobalIdentifierValue::Other,
b"SVGGeometryElement" => PureGlobalIdentifierValue::Other,
b"SVGGradientElement" => PureGlobalIdentifierValue::Other,
b"SVGGraphicsElement" => PureGlobalIdentifierValue::Other,
b"SVGImageElement" => PureGlobalIdentifierValue::Other,
b"SVGLength" => PureGlobalIdentifierValue::Other,
b"SVGLengthList" => PureGlobalIdentifierValue::Other,
b"SVGLineElement" => PureGlobalIdentifierValue::Other,
b"SVGLinearGradientElement" => PureGlobalIdentifierValue::Other,
b"SVGMPathElement" => PureGlobalIdentifierValue::Other,
b"SVGMarkerElement" => PureGlobalIdentifierValue::Other,
b"SVGMaskElement" => PureGlobalIdentifierValue::Other,
b"SVGMatrix" => PureGlobalIdentifierValue::Other,
b"SVGMetadataElement" => PureGlobalIdentifierValue::Other,
b"SVGNumber" => PureGlobalIdentifierValue::Other,
b"SVGNumberList" => PureGlobalIdentifierValue::Other,
b"SVGPathElement" => PureGlobalIdentifierValue::Other,
b"SVGPatternElement" => PureGlobalIdentifierValue::Other,
b"SVGPoint" => PureGlobalIdentifierValue::Other,
b"SVGPointList" => PureGlobalIdentifierValue::Other,
b"SVGPolygonElement" => PureGlobalIdentifierValue::Other,
b"SVGPolylineElement" => PureGlobalIdentifierValue::Other,
b"SVGPreserveAspectRatio" => PureGlobalIdentifierValue::Other,
b"SVGRadialGradientElement" => PureGlobalIdentifierValue::Other,
b"SVGRect" => PureGlobalIdentifierValue::Other,
b"SVGRectElement" => PureGlobalIdentifierValue::Other,
b"SVGSVGElement" => PureGlobalIdentifierValue::Other,
b"SVGScriptElement" => PureGlobalIdentifierValue::Other,
b"SVGSetElement" => PureGlobalIdentifierValue::Other,
b"SVGStopElement" => PureGlobalIdentifierValue::Other,
b"SVGStringList" => PureGlobalIdentifierValue::Other,
b"SVGStyleElement" => PureGlobalIdentifierValue::Other,
b"SVGSwitchElement" => PureGlobalIdentifierValue::Other,
b"SVGSymbolElement" => PureGlobalIdentifierValue::Other,
b"SVGTSpanElement" => PureGlobalIdentifierValue::Other,
b"SVGTextContentElement" => PureGlobalIdentifierValue::Other,
b"SVGTextElement" => PureGlobalIdentifierValue::Other,
b"SVGTextPathElement" => PureGlobalIdentifierValue::Other,
b"SVGTextPositioningElement" => PureGlobalIdentifierValue::Other,
b"SVGTitleElement" => PureGlobalIdentifierValue::Other,
b"SVGTransform" => PureGlobalIdentifierValue::Other,
b"SVGTransformList" => PureGlobalIdentifierValue::Other,
b"SVGUnitTypes" => PureGlobalIdentifierValue::Other,
b"SVGUseElement" => PureGlobalIdentifierValue::Other,
b"SVGViewElement" => PureGlobalIdentifierValue::Other,
b"AnalyserNode" => PureGlobalIdentifierValue::Other,
b"Animation" => PureGlobalIdentifierValue::Other,
b"AnimationEffect" => PureGlobalIdentifierValue::Other,
b"AnimationEvent" => PureGlobalIdentifierValue::Other,
b"AnimationPlaybackEvent" => PureGlobalIdentifierValue::Other,
b"AnimationTimeline" => PureGlobalIdentifierValue::Other,
b"Attr" => PureGlobalIdentifierValue::Other,
b"Audio" => PureGlobalIdentifierValue::Other,
b"AudioBuffer" => PureGlobalIdentifierValue::Other,
b"AudioBufferSourceNode" => PureGlobalIdentifierValue::Other,
b"AudioDestinationNode" => PureGlobalIdentifierValue::Other,
b"AudioListener" => PureGlobalIdentifierValue::Other,
b"AudioNode" => PureGlobalIdentifierValue::Other,
b"AudioParam" => PureGlobalIdentifierValue::Other,
b"AudioProcessingEvent" => PureGlobalIdentifierValue::Other,
b"AudioScheduledSourceNode" => PureGlobalIdentifierValue::Other,
b"BarProp" => PureGlobalIdentifierValue::Other,
b"BeforeUnloadEvent" => PureGlobalIdentifierValue::Other,
b"BiquadFilterNode" => PureGlobalIdentifierValue::Other,
b"Blob" => PureGlobalIdentifierValue::Other,
b"BlobEvent" => PureGlobalIdentifierValue::Other,
b"ByteLengthQueuingStrategy" => PureGlobalIdentifierValue::Other,
b"CDATASection" => PureGlobalIdentifierValue::Other,
b"CSS" => PureGlobalIdentifierValue::Other,
b"CanvasGradient" => PureGlobalIdentifierValue::Other,
b"CanvasPattern" => PureGlobalIdentifierValue::Other,
b"CanvasRenderingContext2D" => PureGlobalIdentifierValue::Other,
b"ChannelMergerNode" => PureGlobalIdentifierValue::Other,
b"ChannelSplitterNode" => PureGlobalIdentifierValue::Other,
b"CharacterData" => PureGlobalIdentifierValue::Other,
b"ClipboardEvent" => PureGlobalIdentifierValue::Other,
b"CloseEvent" => PureGlobalIdentifierValue::Other,
b"Comment" => PureGlobalIdentifierValue::Other,
b"CompositionEvent" => PureGlobalIdentifierValue::Other,
b"ConvolverNode" => PureGlobalIdentifierValue::Other,
b"CountQueuingStrategy" => PureGlobalIdentifierValue::Other,
b"Crypto" => PureGlobalIdentifierValue::Other,
b"CustomElementRegistry" => PureGlobalIdentifierValue::Other,
b"CustomEvent" => PureGlobalIdentifierValue::Other,
b"DOMException" => PureGlobalIdentifierValue::Other,
b"DOMImplementation" => PureGlobalIdentifierValue::Other,
b"DOMMatrix" => PureGlobalIdentifierValue::Other,
b"DOMMatrixReadOnly" => PureGlobalIdentifierValue::Other,
b"DOMParser" => PureGlobalIdentifierValue::Other,
b"DOMPoint" => PureGlobalIdentifierValue::Other,
b"DOMPointReadOnly" => PureGlobalIdentifierValue::Other,
b"DOMQuad" => PureGlobalIdentifierValue::Other,
b"DOMRect" => PureGlobalIdentifierValue::Other,
b"DOMRectList" => PureGlobalIdentifierValue::Other,
b"DOMRectReadOnly" => PureGlobalIdentifierValue::Other,
b"DOMStringList" => PureGlobalIdentifierValue::Other,
b"DOMStringMap" => PureGlobalIdentifierValue::Other,
b"DOMTokenList" => PureGlobalIdentifierValue::Other,
b"DataTransfer" => PureGlobalIdentifierValue::Other,
b"DataTransferItem" => PureGlobalIdentifierValue::Other,
b"DataTransferItemList" => PureGlobalIdentifierValue::Other,
b"DelayNode" => PureGlobalIdentifierValue::Other,
b"Document" => PureGlobalIdentifierValue::Other,
b"DocumentFragment" => PureGlobalIdentifierValue::Other,
b"DocumentTimeline" => PureGlobalIdentifierValue::Other,
b"DocumentType" => PureGlobalIdentifierValue::Other,
b"DragEvent" => PureGlobalIdentifierValue::Other,
b"DynamicsCompressorNode" => PureGlobalIdentifierValue::Other,
b"Element" => PureGlobalIdentifierValue::Other,
b"ErrorEvent" => PureGlobalIdentifierValue::Other,
b"EventSource" => PureGlobalIdentifierValue::Other,
b"File" => PureGlobalIdentifierValue::Other,
b"FileList" => PureGlobalIdentifierValue::Other,
b"FileReader" => PureGlobalIdentifierValue::Other,
b"FocusEvent" => PureGlobalIdentifierValue::Other,
b"FontFace" => PureGlobalIdentifierValue::Other,
b"FormData" => PureGlobalIdentifierValue::Other,
b"GainNode" => PureGlobalIdentifierValue::Other,
b"Gamepad" => PureGlobalIdentifierValue::Other,
b"GamepadButton" => PureGlobalIdentifierValue::Other,
b"GamepadEvent" => PureGlobalIdentifierValue::Other,
b"Geolocation" => PureGlobalIdentifierValue::Other,
b"GeolocationPositionError" => PureGlobalIdentifierValue::Other,
b"HTMLAllCollection" => PureGlobalIdentifierValue::Other,
b"HTMLAnchorElement" => PureGlobalIdentifierValue::Other,
b"HTMLAreaElement" => PureGlobalIdentifierValue::Other,
b"HTMLAudioElement" => PureGlobalIdentifierValue::Other,
b"HTMLBRElement" => PureGlobalIdentifierValue::Other,
b"HTMLBaseElement" => PureGlobalIdentifierValue::Other,
b"HTMLBodyElement" => PureGlobalIdentifierValue::Other,
b"HTMLButtonElement" => PureGlobalIdentifierValue::Other,
b"HTMLCanvasElement" => PureGlobalIdentifierValue::Other,
b"HTMLCollection" => PureGlobalIdentifierValue::Other,
b"HTMLDListElement" => PureGlobalIdentifierValue::Other,
b"HTMLDataElement" => PureGlobalIdentifierValue::Other,
b"HTMLDataListElement" => PureGlobalIdentifierValue::Other,
b"HTMLDetailsElement" => PureGlobalIdentifierValue::Other,
b"HTMLDirectoryElement" => PureGlobalIdentifierValue::Other,
b"HTMLDivElement" => PureGlobalIdentifierValue::Other,
b"HTMLDocument" => PureGlobalIdentifierValue::Other,
b"HTMLElement" => PureGlobalIdentifierValue::Other,
b"HTMLEmbedElement" => PureGlobalIdentifierValue::Other,
b"HTMLFieldSetElement" => PureGlobalIdentifierValue::Other,
b"HTMLFontElement" => PureGlobalIdentifierValue::Other,
b"HTMLFormControlsCollection" => PureGlobalIdentifierValue::Other,
b"HTMLFormElement" => PureGlobalIdentifierValue::Other,
b"HTMLFrameElement" => PureGlobalIdentifierValue::Other,
b"HTMLFrameSetElement" => PureGlobalIdentifierValue::Other,
b"HTMLHRElement" => PureGlobalIdentifierValue::Other,
b"HTMLHeadElement" => PureGlobalIdentifierValue::Other,
b"HTMLHeadingElement" => PureGlobalIdentifierValue::Other,
b"HTMLHtmlElement" => PureGlobalIdentifierValue::Other,
b"HTMLIFrameElement" => PureGlobalIdentifierValue::Other,
b"HTMLImageElement" => PureGlobalIdentifierValue::Other,
b"HTMLInputElement" => PureGlobalIdentifierValue::Other,
b"HTMLLIElement" => PureGlobalIdentifierValue::Other,
b"HTMLLabelElement" => PureGlobalIdentifierValue::Other,
b"HTMLLegendElement" => PureGlobalIdentifierValue::Other,
b"HTMLLinkElement" => PureGlobalIdentifierValue::Other,
b"HTMLMapElement" => PureGlobalIdentifierValue::Other,
b"HTMLMarqueeElement" => PureGlobalIdentifierValue::Other,
b"HTMLMediaElement" => PureGlobalIdentifierValue::Other,
b"HTMLMenuElement" => PureGlobalIdentifierValue::Other,
b"HTMLMetaElement" => PureGlobalIdentifierValue::Other,
b"HTMLMeterElement" => PureGlobalIdentifierValue::Other,
b"HTMLModElement" => PureGlobalIdentifierValue::Other,
b"HTMLOListElement" => PureGlobalIdentifierValue::Other,
b"HTMLObjectElement" => PureGlobalIdentifierValue::Other,
b"HTMLOptGroupElement" => PureGlobalIdentifierValue::Other,
b"HTMLOptionElement" => PureGlobalIdentifierValue::Other,
b"HTMLOptionsCollection" => PureGlobalIdentifierValue::Other,
b"HTMLOutputElement" => PureGlobalIdentifierValue::Other,
b"HTMLParagraphElement" => PureGlobalIdentifierValue::Other,
b"HTMLParamElement" => PureGlobalIdentifierValue::Other,
b"HTMLPictureElement" => PureGlobalIdentifierValue::Other,
b"HTMLPreElement" => PureGlobalIdentifierValue::Other,
b"HTMLProgressElement" => PureGlobalIdentifierValue::Other,
b"HTMLQuoteElement" => PureGlobalIdentifierValue::Other,
b"HTMLScriptElement" => PureGlobalIdentifierValue::Other,
b"HTMLSelectElement" => PureGlobalIdentifierValue::Other,
b"HTMLSlotElement" => PureGlobalIdentifierValue::Other,
b"HTMLSourceElement" => PureGlobalIdentifierValue::Other,
b"HTMLSpanElement" => PureGlobalIdentifierValue::Other,
b"HTMLStyleElement" => PureGlobalIdentifierValue::Other,
b"HTMLTableCaptionElement" => PureGlobalIdentifierValue::Other,
b"HTMLTableCellElement" => PureGlobalIdentifierValue::Other,
b"HTMLTableColElement" => PureGlobalIdentifierValue::Other,
b"HTMLTableElement" => PureGlobalIdentifierValue::Other,
b"HTMLTableRowElement" => PureGlobalIdentifierValue::Other,
b"HTMLTableSectionElement" => PureGlobalIdentifierValue::Other,
b"HTMLTemplateElement" => PureGlobalIdentifierValue::Other,
b"HTMLTextAreaElement" => PureGlobalIdentifierValue::Other,
b"HTMLTimeElement" => PureGlobalIdentifierValue::Other,
b"HTMLTitleElement" => PureGlobalIdentifierValue::Other,
b"HTMLTrackElement" => PureGlobalIdentifierValue::Other,
b"HTMLUListElement" => PureGlobalIdentifierValue::Other,
b"HTMLUnknownElement" => PureGlobalIdentifierValue::Other,
b"HTMLVideoElement" => PureGlobalIdentifierValue::Other,
b"HashChangeEvent" => PureGlobalIdentifierValue::Other,
b"Headers" => PureGlobalIdentifierValue::Other,
b"History" => PureGlobalIdentifierValue::Other,
b"IDBCursor" => PureGlobalIdentifierValue::Other,
b"IDBCursorWithValue" => PureGlobalIdentifierValue::Other,
b"IDBDatabase" => PureGlobalIdentifierValue::Other,
b"IDBFactory" => PureGlobalIdentifierValue::Other,
b"IDBIndex" => PureGlobalIdentifierValue::Other,
b"IDBKeyRange" => PureGlobalIdentifierValue::Other,
b"IDBObjectStore" => PureGlobalIdentifierValue::Other,
b"IDBOpenDBRequest" => PureGlobalIdentifierValue::Other,
b"IDBRequest" => PureGlobalIdentifierValue::Other,
b"IDBTransaction" => PureGlobalIdentifierValue::Other,
b"IDBVersionChangeEvent" => PureGlobalIdentifierValue::Other,
b"Image" => PureGlobalIdentifierValue::Other,
b"ImageData" => PureGlobalIdentifierValue::Other,
b"InputEvent" => PureGlobalIdentifierValue::Other,
b"IntersectionObserver" => PureGlobalIdentifierValue::Other,
b"IntersectionObserverEntry" => PureGlobalIdentifierValue::Other,
b"KeyboardEvent" => PureGlobalIdentifierValue::Other,
b"KeyframeEffect" => PureGlobalIdentifierValue::Other,
b"Location" => PureGlobalIdentifierValue::Other,
b"MediaCapabilities" => PureGlobalIdentifierValue::Other,
b"MediaElementAudioSourceNode" => PureGlobalIdentifierValue::Other,
b"MediaEncryptedEvent" => PureGlobalIdentifierValue::Other,
b"MediaError" => PureGlobalIdentifierValue::Other,
b"MediaList" => PureGlobalIdentifierValue::Other,
b"MediaQueryList" => PureGlobalIdentifierValue::Other,
b"MediaQueryListEvent" => PureGlobalIdentifierValue::Other,
b"MediaRecorder" => PureGlobalIdentifierValue::Other,
b"MediaSource" => PureGlobalIdentifierValue::Other,
b"MediaStream" => PureGlobalIdentifierValue::Other,
b"MediaStreamAudioDestinationNode" => PureGlobalIdentifierValue::Other,
b"MediaStreamAudioSourceNode" => PureGlobalIdentifierValue::Other,
b"MediaStreamTrack" => PureGlobalIdentifierValue::Other,
b"MediaStreamTrackEvent" => PureGlobalIdentifierValue::Other,
b"MimeType" => PureGlobalIdentifierValue::Other,
b"MimeTypeArray" => PureGlobalIdentifierValue::Other,
b"MouseEvent" => PureGlobalIdentifierValue::Other,
b"MutationEvent" => PureGlobalIdentifierValue::Other,
b"MutationObserver" => PureGlobalIdentifierValue::Other,
b"MutationRecord" => PureGlobalIdentifierValue::Other,
b"NamedNodeMap" => PureGlobalIdentifierValue::Other,
b"Navigator" => PureGlobalIdentifierValue::Other,
b"Node" => PureGlobalIdentifierValue::Other,
b"NodeFilter" => PureGlobalIdentifierValue::Other,
b"NodeIterator" => PureGlobalIdentifierValue::Other,
b"NodeList" => PureGlobalIdentifierValue::Other,
b"Notification" => PureGlobalIdentifierValue::Other,
b"OfflineAudioCompletionEvent" => PureGlobalIdentifierValue::Other,
b"Option" => PureGlobalIdentifierValue::Other,
b"OscillatorNode" => PureGlobalIdentifierValue::Other,
b"PageTransitionEvent" => PureGlobalIdentifierValue::Other,
b"Path2D" => PureGlobalIdentifierValue::Other,
b"Performance" => PureGlobalIdentifierValue::Other,
b"PerformanceEntry" => PureGlobalIdentifierValue::Other,
b"PerformanceMark" => PureGlobalIdentifierValue::Other,
b"PerformanceMeasure" => PureGlobalIdentifierValue::Other,
b"PerformanceNavigation" => PureGlobalIdentifierValue::Other,
b"PerformanceObserver" => PureGlobalIdentifierValue::Other,
b"PerformanceObserverEntryList" => PureGlobalIdentifierValue::Other,
b"PerformanceResourceTiming" => PureGlobalIdentifierValue::Other,
b"PerformanceTiming" => PureGlobalIdentifierValue::Other,
b"PeriodicWave" => PureGlobalIdentifierValue::Other,
b"Plugin" => PureGlobalIdentifierValue::Other,
b"PluginArray" => PureGlobalIdentifierValue::Other,
b"PointerEvent" => PureGlobalIdentifierValue::Other,
b"PopStateEvent" => PureGlobalIdentifierValue::Other,
b"ProcessingInstruction" => PureGlobalIdentifierValue::Other,
b"ProgressEvent" => PureGlobalIdentifierValue::Other,
b"PromiseRejectionEvent" => PureGlobalIdentifierValue::Other,
b"RTCCertificate" => PureGlobalIdentifierValue::Other,
b"RTCDTMFSender" => PureGlobalIdentifierValue::Other,
b"RTCDTMFToneChangeEvent" => PureGlobalIdentifierValue::Other,
b"RTCDataChannel" => PureGlobalIdentifierValue::Other,
b"RTCDataChannelEvent" => PureGlobalIdentifierValue::Other,
b"RTCIceCandidate" => PureGlobalIdentifierValue::Other,
b"RTCPeerConnection" => PureGlobalIdentifierValue::Other,
b"RTCPeerConnectionIceEvent" => PureGlobalIdentifierValue::Other,
b"RTCRtpReceiver" => PureGlobalIdentifierValue::Other,
b"RTCRtpSender" => PureGlobalIdentifierValue::Other,
b"RTCRtpTransceiver" => PureGlobalIdentifierValue::Other,
b"RTCSessionDescription" => PureGlobalIdentifierValue::Other,
b"RTCStatsReport" => PureGlobalIdentifierValue::Other,
b"RTCTrackEvent" => PureGlobalIdentifierValue::Other,
b"RadioNodeList" => PureGlobalIdentifierValue::Other,
b"Range" => PureGlobalIdentifierValue::Other,
b"ReadableStream" => PureGlobalIdentifierValue::Other,
b"Request" => PureGlobalIdentifierValue::Other,
b"ResizeObserver" => PureGlobalIdentifierValue::Other,
b"ResizeObserverEntry" => PureGlobalIdentifierValue::Other,
b"Response" => PureGlobalIdentifierValue::Other,
b"Screen" => PureGlobalIdentifierValue::Other,
b"ScriptProcessorNode" => PureGlobalIdentifierValue::Other,
b"SecurityPolicyViolationEvent" => PureGlobalIdentifierValue::Other,
b"Selection" => PureGlobalIdentifierValue::Other,
b"ShadowRoot" => PureGlobalIdentifierValue::Other,
b"SourceBuffer" => PureGlobalIdentifierValue::Other,
b"SourceBufferList" => PureGlobalIdentifierValue::Other,
b"SpeechSynthesisEvent" => PureGlobalIdentifierValue::Other,
b"SpeechSynthesisUtterance" => PureGlobalIdentifierValue::Other,
b"StaticRange" => PureGlobalIdentifierValue::Other,
b"Storage" => PureGlobalIdentifierValue::Other,
b"StorageEvent" => PureGlobalIdentifierValue::Other,
b"StyleSheet" => PureGlobalIdentifierValue::Other,
b"StyleSheetList" => PureGlobalIdentifierValue::Other,
b"Text" => PureGlobalIdentifierValue::Other,
b"TextMetrics" => PureGlobalIdentifierValue::Other,
b"TextTrack" => PureGlobalIdentifierValue::Other,
b"TextTrackCue" => PureGlobalIdentifierValue::Other,
b"TextTrackCueList" => PureGlobalIdentifierValue::Other,
b"TextTrackList" => PureGlobalIdentifierValue::Other,
b"TimeRanges" => PureGlobalIdentifierValue::Other,
b"TrackEvent" => PureGlobalIdentifierValue::Other,
b"TransitionEvent" => PureGlobalIdentifierValue::Other,
b"TreeWalker" => PureGlobalIdentifierValue::Other,
b"UIEvent" => PureGlobalIdentifierValue::Other,
b"VTTCue" => PureGlobalIdentifierValue::Other,
b"ValidityState" => PureGlobalIdentifierValue::Other,
b"VisualViewport" => PureGlobalIdentifierValue::Other,
b"WaveShaperNode" => PureGlobalIdentifierValue::Other,
b"WebGLActiveInfo" => PureGlobalIdentifierValue::Other,
b"WebGLBuffer" => PureGlobalIdentifierValue::Other,
b"WebGLContextEvent" => PureGlobalIdentifierValue::Other,
b"WebGLFramebuffer" => PureGlobalIdentifierValue::Other,
b"WebGLProgram" => PureGlobalIdentifierValue::Other,
b"WebGLQuery" => PureGlobalIdentifierValue::Other,
b"WebGLRenderbuffer" => PureGlobalIdentifierValue::Other,
b"WebGLRenderingContext" => PureGlobalIdentifierValue::Other,
b"WebGLSampler" => PureGlobalIdentifierValue::Other,
b"WebGLShader" => PureGlobalIdentifierValue::Other,
b"WebGLShaderPrecisionFormat" => PureGlobalIdentifierValue::Other,
b"WebGLSync" => PureGlobalIdentifierValue::Other,
b"WebGLTexture" => PureGlobalIdentifierValue::Other,
b"WebGLUniformLocation" => PureGlobalIdentifierValue::Other,
b"WebKitCSSMatrix" => PureGlobalIdentifierValue::Other,
b"WebSocket" => PureGlobalIdentifierValue::Other,
b"WheelEvent" => PureGlobalIdentifierValue::Other,
b"Window" => PureGlobalIdentifierValue::Other,
b"Worker" => PureGlobalIdentifierValue::Other,
b"XMLDocument" => PureGlobalIdentifierValue::Other,
b"XMLHttpRequest" => PureGlobalIdentifierValue::Other,
b"XMLHttpRequestEventTarget" => PureGlobalIdentifierValue::Other,
b"XMLHttpRequestUpload" => PureGlobalIdentifierValue::Other,
b"XMLSerializer" => PureGlobalIdentifierValue::Other,
b"XPathEvaluator" => PureGlobalIdentifierValue::Other,
b"XPathExpression" => PureGlobalIdentifierValue::Other,
b"XPathResult" => PureGlobalIdentifierValue::Other,
b"XSLTProcessor" => PureGlobalIdentifierValue::Other,
b"alert" => PureGlobalIdentifierValue::Other,
b"atob" => PureGlobalIdentifierValue::Other,
b"blur" => PureGlobalIdentifierValue::Other,
b"btoa" => PureGlobalIdentifierValue::Other,
b"cancelAnimationFrame" => PureGlobalIdentifierValue::Other,
b"captureEvents" => PureGlobalIdentifierValue::Other,
b"close" => PureGlobalIdentifierValue::Other,
b"closed" => PureGlobalIdentifierValue::Other,
b"confirm" => PureGlobalIdentifierValue::Other,
b"customElements" => PureGlobalIdentifierValue::Other,
b"devicePixelRatio" => PureGlobalIdentifierValue::Other,
b"document" => PureGlobalIdentifierValue::Other,
b"event" => PureGlobalIdentifierValue::Other,
b"fetch" => PureGlobalIdentifierValue::Other,
b"find" => PureGlobalIdentifierValue::Other,
b"focus" => PureGlobalIdentifierValue::Other,
b"frameElement" => PureGlobalIdentifierValue::Other,
b"frames" => PureGlobalIdentifierValue::Other,
b"getComputedStyle" => PureGlobalIdentifierValue::Other,
b"getSelection" => PureGlobalIdentifierValue::Other,
b"history" => PureGlobalIdentifierValue::Other,
b"indexedDB" => PureGlobalIdentifierValue::Other,
b"isSecureContext" => PureGlobalIdentifierValue::Other,
b"length" => PureGlobalIdentifierValue::Other,
b"location" => PureGlobalIdentifierValue::Other,
b"locationbar" => PureGlobalIdentifierValue::Other,
b"matchMedia" => PureGlobalIdentifierValue::Other,
b"menubar" => PureGlobalIdentifierValue::Other,
b"moveBy" => PureGlobalIdentifierValue::Other,
b"moveTo" => PureGlobalIdentifierValue::Other,
b"name" => PureGlobalIdentifierValue::Other,
b"navigator" => PureGlobalIdentifierValue::Other,
b"onabort" => PureGlobalIdentifierValue::Other,
b"onafterprint" => PureGlobalIdentifierValue::Other,
b"onanimationend" => PureGlobalIdentifierValue::Other,
b"onanimationiteration" => PureGlobalIdentifierValue::Other,
b"onanimationstart" => PureGlobalIdentifierValue::Other,
b"onbeforeprint" => PureGlobalIdentifierValue::Other,
b"onbeforeunload" => PureGlobalIdentifierValue::Other,
b"onblur" => PureGlobalIdentifierValue::Other,
b"oncanplay" => PureGlobalIdentifierValue::Other,
b"oncanplaythrough" => PureGlobalIdentifierValue::Other,
b"onchange" => PureGlobalIdentifierValue::Other,
b"onclick" => PureGlobalIdentifierValue::Other,
b"oncontextmenu" => PureGlobalIdentifierValue::Other,
b"oncuechange" => PureGlobalIdentifierValue::Other,
b"ondblclick" => PureGlobalIdentifierValue::Other,
b"ondrag" => PureGlobalIdentifierValue::Other,
b"ondragend" => PureGlobalIdentifierValue::Other,
b"ondragenter" => PureGlobalIdentifierValue::Other,
b"ondragleave" => PureGlobalIdentifierValue::Other,
b"ondragover" => PureGlobalIdentifierValue::Other,
b"ondragstart" => PureGlobalIdentifierValue::Other,
b"ondrop" => PureGlobalIdentifierValue::Other,
b"ondurationchange" => PureGlobalIdentifierValue::Other,
b"onemptied" => PureGlobalIdentifierValue::Other,
b"onended" => PureGlobalIdentifierValue::Other,
b"onerror" => PureGlobalIdentifierValue::Other,
b"onfocus" => PureGlobalIdentifierValue::Other,
b"ongotpointercapture" => PureGlobalIdentifierValue::Other,
b"onhashchange" => PureGlobalIdentifierValue::Other,
b"oninput" => PureGlobalIdentifierValue::Other,
b"oninvalid" => PureGlobalIdentifierValue::Other,
b"onkeydown" => PureGlobalIdentifierValue::Other,
b"onkeypress" => PureGlobalIdentifierValue::Other,
b"onkeyup" => PureGlobalIdentifierValue::Other,
b"onlanguagechange" => PureGlobalIdentifierValue::Other,
b"onload" => PureGlobalIdentifierValue::Other,
b"onloadeddata" => PureGlobalIdentifierValue::Other,
b"onloadedmetadata" => PureGlobalIdentifierValue::Other,
b"onloadstart" => PureGlobalIdentifierValue::Other,
b"onlostpointercapture" => PureGlobalIdentifierValue::Other,
b"onmessage" => PureGlobalIdentifierValue::Other,
b"onmousedown" => PureGlobalIdentifierValue::Other,
b"onmouseenter" => PureGlobalIdentifierValue::Other,
b"onmouseleave" => PureGlobalIdentifierValue::Other,
b"onmousemove" => PureGlobalIdentifierValue::Other,
b"onmouseout" => PureGlobalIdentifierValue::Other,
b"onmouseover" => PureGlobalIdentifierValue::Other,
b"onmouseup" => PureGlobalIdentifierValue::Other,
b"onoffline" => PureGlobalIdentifierValue::Other,
b"ononline" => PureGlobalIdentifierValue::Other,
b"onpagehide" => PureGlobalIdentifierValue::Other,
b"onpageshow" => PureGlobalIdentifierValue::Other,
b"onpause" => PureGlobalIdentifierValue::Other,
b"onplay" => PureGlobalIdentifierValue::Other,
b"onplaying" => PureGlobalIdentifierValue::Other,
b"onpointercancel" => PureGlobalIdentifierValue::Other,
b"onpointerdown" => PureGlobalIdentifierValue::Other,
b"onpointerenter" => PureGlobalIdentifierValue::Other,
b"onpointerleave" => PureGlobalIdentifierValue::Other,
b"onpointermove" => PureGlobalIdentifierValue::Other,
b"onpointerout" => PureGlobalIdentifierValue::Other,
b"onpointerover" => PureGlobalIdentifierValue::Other,
b"onpointerup" => PureGlobalIdentifierValue::Other,
b"onpopstate" => PureGlobalIdentifierValue::Other,
b"onprogress" => PureGlobalIdentifierValue::Other,
b"onratechange" => PureGlobalIdentifierValue::Other,
b"onrejectionhandled" => PureGlobalIdentifierValue::Other,
b"onreset" => PureGlobalIdentifierValue::Other,
b"onresize" => PureGlobalIdentifierValue::Other,
b"onscroll" => PureGlobalIdentifierValue::Other,
b"onseeked" => PureGlobalIdentifierValue::Other,
b"onseeking" => PureGlobalIdentifierValue::Other,
b"onselect" => PureGlobalIdentifierValue::Other,
b"onstalled" => PureGlobalIdentifierValue::Other,
b"onstorage" => PureGlobalIdentifierValue::Other,
b"onsubmit" => PureGlobalIdentifierValue::Other,
b"onsuspend" => PureGlobalIdentifierValue::Other,
b"ontimeupdate" => PureGlobalIdentifierValue::Other,
b"ontoggle" => PureGlobalIdentifierValue::Other,
b"ontransitioncancel" => PureGlobalIdentifierValue::Other,
b"ontransitionend" => PureGlobalIdentifierValue::Other,
b"ontransitionrun" => PureGlobalIdentifierValue::Other,
b"ontransitionstart" => PureGlobalIdentifierValue::Other,
b"onunhandledrejection" => PureGlobalIdentifierValue::Other,
b"onunload" => PureGlobalIdentifierValue::Other,
b"onvolumechange" => PureGlobalIdentifierValue::Other,
b"onwaiting" => PureGlobalIdentifierValue::Other,
b"onwebkitanimationend" => PureGlobalIdentifierValue::Other,
b"onwebkitanimationiteration" => PureGlobalIdentifierValue::Other,
b"onwebkitanimationstart" => PureGlobalIdentifierValue::Other,
b"onwebkittransitionend" => PureGlobalIdentifierValue::Other,
b"onwheel" => PureGlobalIdentifierValue::Other,
b"open" => PureGlobalIdentifierValue::Other,
b"opener" => PureGlobalIdentifierValue::Other,
b"origin" => PureGlobalIdentifierValue::Other,
b"outerHeight" => PureGlobalIdentifierValue::Other,
b"outerWidth" => PureGlobalIdentifierValue::Other,
b"parent" => PureGlobalIdentifierValue::Other,
b"performance" => PureGlobalIdentifierValue::Other,
b"personalbar" => PureGlobalIdentifierValue::Other,
b"postMessage" => PureGlobalIdentifierValue::Other,
b"print" => PureGlobalIdentifierValue::Other,
b"prompt" => PureGlobalIdentifierValue::Other,
b"releaseEvents" => PureGlobalIdentifierValue::Other,
b"requestAnimationFrame" => PureGlobalIdentifierValue::Other,
b"resizeBy" => PureGlobalIdentifierValue::Other,
b"resizeTo" => PureGlobalIdentifierValue::Other,
b"screen" => PureGlobalIdentifierValue::Other,
b"screenLeft" => PureGlobalIdentifierValue::Other,
b"screenTop" => PureGlobalIdentifierValue::Other,
b"screenX" => PureGlobalIdentifierValue::Other,
b"screenY" => PureGlobalIdentifierValue::Other,
b"scroll" => PureGlobalIdentifierValue::Other,
b"scrollBy" => PureGlobalIdentifierValue::Other,
b"scrollTo" => PureGlobalIdentifierValue::Other,
b"scrollbars" => PureGlobalIdentifierValue::Other,
b"self" => PureGlobalIdentifierValue::Other,
b"speechSynthesis" => PureGlobalIdentifierValue::Other,
b"status" => PureGlobalIdentifierValue::Other,
b"statusbar" => PureGlobalIdentifierValue::Other,
b"stop" => PureGlobalIdentifierValue::Other,
b"toolbar" => PureGlobalIdentifierValue::Other,
b"top" => PureGlobalIdentifierValue::Other,
b"webkitURL" => PureGlobalIdentifierValue::Other,
b"window" => PureGlobalIdentifierValue::Other,
b"crypto" => PureGlobalIdentifierValue::Other,
};
fn load_corpus() -> Vec<Vec<u8>> {
let candidates = [
concat!(
env!("CARGO_MANIFEST_DIR"),
"/../../test/snippets/react-dom.development.js"
),
concat!(
env!("CARGO_MANIFEST_DIR"),
"/../../node_modules/typescript/lib/typescript.js"
),
];
let src = candidates
.iter()
.find_map(|p| std::fs::read_to_string(p).ok())
.expect("no corpus file found");
let re = regex::Regex::new(r"[A-Za-z_$][A-Za-z0-9_$]*").unwrap();
re.find_iter(&src)
.map(|m| m.as_str().as_bytes().to_vec())
.collect()
}
fn table_keys() -> Vec<Vec<u8>> {
PURE_GLOBAL_IDENTIFIER_MAP
.keys()
.map(|k| k.to_vec())
.collect()
}
fn rand_idents(n: usize, lo: usize, hi: usize, exclude: &HashSet<Vec<u8>>) -> Vec<Vec<u8>> {
const FIRST: &[u8] = b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$";
const REST: &[u8] = b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$";
let mut state: u64 = 0x243f_6a88_85a3_08d3;
let mut next = || {
state = state
.wrapping_mul(6364136223846793005)
.wrapping_add(1442695040888963407);
state
};
let mut out = Vec::with_capacity(n);
while out.len() < n {
let len = lo + (next() as usize % (hi - lo + 1));
let mut s = Vec::with_capacity(len);
s.push(FIRST[next() as usize % FIRST.len()]);
for _ in 1..len {
s.push(REST[next() as usize % REST.len()]);
}
if !exclude.contains(&s) {
out.push(s);
}
}
out
}
fn bench(c: &mut Criterion) {
let corpus = load_corpus();
let keys = table_keys();
let key_set: HashSet<Vec<u8>> = keys.iter().cloned().collect();
let hits = corpus.iter().filter(|k| key_set.contains(*k)).count();
eprintln!(
"corpus: {} idents ({} unique), table: {} keys, hit rate: {:.3}%",
corpus.len(),
corpus.iter().collect::<HashSet<_>>().len(),
keys.len(),
100.0 * hits as f64 / corpus.len() as f64
);
let short_miss = rand_idents(1000, 1, 5, &key_set);
let long_miss = rand_idents(1000, 12, 20, &key_set);
let cases: &[(&str, &[Vec<u8>])] = &[
("lookup_miss_heavy", &corpus),
("lookup_hits_only", &keys),
("lookup_short_miss", &short_miss),
("lookup_long_miss", &long_miss),
];
for (name, data) in cases {
let mut g = c.benchmark_group(*name);
g.throughput(criterion::Throughput::Elements(data.len() as u64));
g.bench_with_input(BenchmarkId::new("phf", data.len()), data, |b, data| {
b.iter(|| {
for k in data.iter() {
black_box(PURE_GLOBAL_IDENTIFIER_MAP.get(black_box(k.as_slice())));
}
})
});
g.bench_with_input(
BenchmarkId::new("generated", data.len()),
data,
|b, data| {
b.iter(|| {
for k in data.iter() {
black_box(lookup_pure_global_identifier(black_box(k.as_slice())));
}
})
},
);
g.finish();
}
}
criterion_group!(benches, bench);
criterion_main!(benches);