[
https://issues.apache.org/jira/browse/AVRO-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17930820#comment-17930820
]
ASF subversion and git services commented on AVRO-4114:
-------------------------------------------------------
Commit fb7e16aea6abed5cdbb2b9c4bfce48f17820797a in avro's branch
refs/heads/dependabot/maven/lang/java/org.hamcrest-hamcrest-library-3.0 from
Serg Tyatin
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=fb7e16aea ]
AVRO-4114: [Ruby] Improve validate_simple method performance (#3300)
> [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
> Priority: Minor
> Labels: pull-request-available
> Fix For: 1.13.0
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> *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)