Skip to content

Instantly share code, notes, and snippets.

View colesbury's full-sized avatar

Sam Gross colesbury

View GitHub Profile
diff --git a/include/pybind11/detail/class.h b/include/pybind11/detail/class.h
index 45697f2..027a717 100644
--- a/include/pybind11/detail/class.h
+++ b/include/pybind11/detail/class.h
@@ -216,19 +216,24 @@ inline void traverse_offset_bases(void *valueptr, const detail::type_info *tinfo
}
inline bool register_instance_impl(void *ptr, instance *self) {
- get_internals().registered_instances.emplace(ptr, self);
+ with_internals([&](internals &internals) {
// NB: Must be at the top of file to avoid including the deprecated "math.h".
// https://stackoverflow.com/questions/6563810/m-pi-works-with-math-h-but-not-with-cmath-in-visual-studio
#ifdef _MSC_VER
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#include <cmath>
#endif
#include "Functions.h"
Performance version: 1.0.0
Report on Linux-4.15.0-55-generic-x86_64-with-glibc2.27
Number of logical CPUs: 80
Start date: 2020-02-13 17:05:00.956227
End date: 2020-02-13 17:28:29.362588
### 2to3 ###
Mean +- std dev: 488 ms +- 7 ms
### chameleon ###
Performance version: 1.0.0
Report on Linux-4.15.0-55-generic-x86_64-with-glibc2.27
Number of logical CPUs: 80
Start date: 2020-02-13 16:13:35.764648
End date: 2020-02-13 16:35:19.621111
### 2to3 ###
Mean +- std dev: 401 ms +- 5 ms
### chameleon ###
diff --git a/src/alloc.c b/src/alloc.c
index b080e6f..7a8f030 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -10,10 +10,12 @@ terms of the MIT license. A copy of the license can be found in the file
#include <string.h> // memset, memcpy, strlen
#include <stdlib.h> // malloc, exit
+#include <stdio.h>
+#include <unistd.h>
diff --git a/Include/mimalloc/mimalloc-atomic.h b/Include/mimalloc/mimalloc-atomic.h
index 7b7cb383d6..aa777cce05 100644
--- a/Include/mimalloc/mimalloc-atomic.h
+++ b/Include/mimalloc/mimalloc-atomic.h
@@ -51,6 +51,40 @@ static inline void* mi_atomic_exchange_ptr(volatile void** p, void* exchange) {
return (void*)mi_atomic_exchange((volatile uintptr_t*)p, (uintptr_t)exchange);
}
+// Atomically read a value
+static inline uintptr_t mi_atomic_read(const volatile uintptr_t* p);
Performance version: 0.9.2
Report on Linux-4.15.0-29-generic-x86_64-with-glibc2.27
Number of logical CPUs: 80
Start date: 2019-12-18 12:00:10.251223
End date: 2019-12-18 12:23:28.490243
### 2to3 ###
Mean +- std dev: 463 ms +- 12 ms
### chameleon ###
Performance version: 0.9.2
Report on Linux-4.15.0-29-generic-x86_64-with-glibc2.27
Number of logical CPUs: 80
Start date: 2019-12-18 10:54:30.825760
End date: 2019-12-18 11:18:11.025926
### 2to3 ###
Mean +- std dev: 465 ms +- 9 ms
### chameleon ###
Performance version: 0.9.2
Report on Linux-4.15.0-29-generic-x86_64-with-glibc2.27
Number of logical CPUs: 80
Start date: 2019-11-27 06:27:09.498956
End date: 2019-11-27 06:36:39.490513
### 2to3 ###
Mean +- std dev: 471 ms +- 12 ms
### chameleon ###
ABC
ABCMeta
ArithmeticError
AssertionError
AsyncGenerator
AsyncIterable
AsyncIterator
AttributeError
Awaitable
BaseException