[
https://issues.apache.org/jira/browse/AVRO-746?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Douglas Creager updated AVRO-746:
---------------------------------
Attachment: 0001-Performance-test-program.patch
Here's a patch that does a performance test of the reference counting
mechanism. It allocates a single int value, and then references and
dereferences that value 100,000,000 times. It runs the test 3 times and prints
out the average time across the 3 runs.
It turns out that the atomic counts are a bigger performance hit than I
thought. With the original implementation, which just uses C's ++ and --
operators, the test case ran in 0.460 seconds. Using the new atomic operation,
it took 1.820 seconds.
That said, I don't know if reference counting is the bottleneck in a "typical"
use of the library. I'm going to add some more performance tests to the test
program to see what we get.
> Atomic reference counts
> -----------------------
>
> Key: AVRO-746
> URL: https://issues.apache.org/jira/browse/AVRO-746
> Project: Avro
> Issue Type: Bug
> Components: c
> Reporter: Douglas Creager
> Assignee: Douglas Creager
> Attachments: 0001-Atomic-reference-counts.patch,
> 0001-Performance-test-program.patch, fixed-make-dist.patch
>
>
> In one of my projects that uses Avro, I pass avro_datum_t instances between
> threads, using the reference count mechanism to make sure that they're not
> freed while any thread still has a reference to them. I was getting some
> spurious segfaults, which were caused by the fact that the reference counts
> aren't updated atomically. I've created a patch that implements atomic
> reference counts, using the [OpenPA
> library|http://trac.mcs.anl.gov/projects/openpa/] to provide the atomic
> operations themselves. (That library is MIT licensed, so it can be included
> in the source tree.)
> Note that only avro_XXX_incref and avro_XXX_decref are thread-safe as a
> result of this patch. For all of the other library functions, the caller is
> still responsible for ensuring thread safety.
> The patch makes sure that the OpenPA code works in both the old autotools
> build and the newer CMake build.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira