Serg Tyatin created AVRO-4114:
---------------------------------
Summary: [Ruby] Improve SchemaValidator.validate_simple method
performance
Key: AVRO-4114
URL: https://issues.apache.org/jira/browse/AVRO-4114
Project: Apache Avro
Issue Type: Improvement
Reporter: Serg Tyatin
*WHY*
The method `SchemaValidator.validate_simple` uses raise/rescue to add errors to
a result. Unfortunately, ruby raise/rescue is slow.
Example performance benchmark
{quote}{{Benchmark.measure \{ 50000.times{ errors=[];begin;raise "aa" ; rescue
;errors<< "error"; end }}}} => 2 seconds
{{Benchmark.measure \{ 50000.times{ errors=[];begin; errors<< "error"; end }}}}
=> 0.003 seconds
{quote}
600x times faster
The {{validate_simple}} method is in use for validation, and, more importantly,
it is called in a loop multiple times for union type encoding.
*WHAT*
Rewrite {{validate_simple method without raise/rescu}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)