[OpenLayers-Dev] createLiteral benchs

Andreas Hocevar andreas.hocevar at gmail.com
Wed Nov 7 07:29:00 EST 2007


Hi,

thanks Pierre for putting together this profiling application! It
helped me to think about the whole thing again, and I found an elegant
method that works with one regex-based split and without
String.replace. It scales linear with both the number of style
attributes and the number of variables to replace in the attributes,
which makes it superior to the other methods in most cases:

http://dev.openlayers.org/sandbox/ahocevar/sldRenderer/examples/profilingAttributeName.html

${name}

feature
returned value : foo
andreas' method: 16ms
returned value : foo
pierre's method: 21ms
returned value : foo
andreas' method 2: 28ms

feature2
returned value : foo
andreas' method: 30ms
returned value : foo
pierre's method: 20ms
returned value : foo
andreas' method 2: 26ms

feature3
returned value : foo
andreas' method: 51ms
returned value : foo
pierre's method: 23ms
returned value : foo
andreas' method 2: 27ms

name: ${name}, age: ${age}, address: ${address}, status: ${status}

feature
returned value : name: foo, age: ${age}, address: ${address}, status: ${status}
andreas' method: 17ms
returned value : name: foo, age: undefined, address: undefined,
status: undefined
pierre's method: 69ms
returned value : name: foo, age: age, address: address, status: status
andreas' method 2: 55ms

feature2
returned value : name: foo, age: 20, address: somewhere, status: single
andreas' method: 36ms
returned value : name: foo, age: 20, address: somewhere, status: single
pierre's method: 574ms
returned value : name: foo, age: 20, address: somewhere, status: single
andreas' method 2: 54ms

feature3
returned value : name: foo, age: 20, address: somewhere, status: single
andreas' method: 65ms
returned value : name: foo, age: 20, address: somewhere, status: single
pierre's method: 65ms
returned value : name: foo, age: 20, address: somewhere, status: single
andreas' method 2: 56ms

Regards,
Andreas.



More information about the Dev mailing list