Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
shaders strings comparisons with Set
(version: 0)
Comparing performance of:
a, b equality vs a, b locale compare vs a, c equality vs a, c locale compare vs d get a vs d get b vs d get c vs d get something not in d
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var a = ` struct Matrices { model: mat4x4f, world: mat4x4f, modelView: mat4x4f, modelViewProjection: mat4x4f }; fn getVertex2DToUVCoords(vertex: vec2f) -> vec2f { return vec2( vertex.x * 0.5 + 0.5, 0.5 - vertex.y * 0.5 ); } fn getVertex3DToUVCoords(vertex: vec3f) -> vec2f { return vec2( vertex.x * 0.5 + 0.5, 0.5 - vertex.y * 0.5 ); } fn getUVCover(uv: vec2f, textureMatrix: mat4x4f) -> vec2f { return (textureMatrix * vec4f(uv, 0.0, 1.0)).xy; } @group(1) @binding(0) var<uniform> matrices: Matrices; struct VSOutput { @builtin(position) position: vec4f, @location(0) uv: vec2f, @location(1) normal: vec3f, }; @fragment fn main(fsInput: VSOutput) -> @location(0) vec4f { // normals return vec4(normalize(fsInput.normal) * 0.5 + 0.5, 1.0); }` var b = ` struct Matrices { model: mat4x4f, world: mat4x4f, modelView: mat4x4f, modelViewProjection: mat4x4f }; fn getVertex2DToUVCoords(vertex: vec2f) -> vec2f { return vec2( vertex.x * 0.5 + 0.5, 0.5 - vertex.y * 0.5 ); } fn getVertex3DToUVCoords(vertex: vec3f) -> vec2f { return vec2( vertex.x * 0.5 + 0.5, 0.5 - vertex.y * 0.5 ); } fn getUVCover(uv: vec2f, textureMatrix: mat4x4f) -> vec2f { return (textureMatrix * vec4f(uv, 0.0, 1.0)).xy; } @group(1) @binding(0) var<uniform> matrices: Matrices; struct VSOutput { @builtin(position) position: vec4f, @location(0) uv: vec2f, @location(1) normal: vec3f, }; @fragment fn main(fsInput: VSOutput) -> @location(0) vec4f { // normals return vec4(normalize(fsInput.normal) * 0.5 + 0.5, 1.0); }` var c = `struct Attributes { @builtin(vertex_index) vertexIndex : u32, @builtin(instance_index) instanceIndex : u32, @location(0) position: vec3f, @location(1) uv: vec2f, @location(2) normal: vec3f }; struct Matrices { model: mat4x4f, world: mat4x4f, modelView: mat4x4f, modelViewProjection: mat4x4f }; struct Camera { model: mat4x4f, view: mat4x4f, projection: mat4x4f }; fn getOutputPosition(position: vec3f) -> vec4f { return matrices.modelViewProjection * vec4f(position, 1.0); } fn getUVCover(uv: vec2f, textureMatrix: mat4x4f) -> vec2f { return (textureMatrix * vec4f(uv, 0.0, 1.0)).xy; } @group(0) @binding(0) var<uniform> camera: Camera; @group(1) @binding(0) var<uniform> matrices: Matrices; struct VertexOutput { @builtin(position) position: vec4f, @location(0) uv: vec2f, @location(1) normal: vec3f, }; @vertex fn main( attributes: Attributes, ) -> VertexOutput { var vsOutput: VertexOutput; vsOutput.position = getOutputPosition(attributes.position); vsOutput.uv = attributes.uv; vsOutput.normal = attributes.normal; return vsOutput; }` var d = new Set([a, b, c])
Tests:
a, b equality
a === b
a, b locale compare
a.localeCompare(b) === 0
a, c equality
a === c
a, c locale compare
a.localeCompare(c) === 0
d get a
d.get(a)
d get b
d.get(b)
d get c
d.get(c)
d get something not in d
d.get('test')
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (8)
Previous results
Fork
Test case name
Result
a, b equality
a, b locale compare
a, c equality
a, c locale compare
d get a
d get b
d get c
d get something not in d
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?