w***g 发帖数: 5958 | 1 我知道placement new可以从给定的内存中创建对象,但是replacement new会重新初始
化对象。不知道c++中有没有什么idiom可以从buffer直接创建对象。或许强制类型转化
可以work,但是心里老觉得不舒服。我的目的是通过mmap来存取对象,从而达到最高的
I/O速度。这也是没办法,数据太多以至于I/O成了bottleneck。我知道post++有这个功
能,但是post++已经好几年都没有更新了。boost支持serialization,但是查了一下
forum发现性能并不是最好。如果有高人知道别的可以通过mmap来实现object
persistency的软件也请告知。 |
x*********h 发帖数: 25 | 2 if converted from some memory buffer, the ctor has no place to be called.
but if your class has no use of ctor, dtor, maybe it could be feasible.
if you have a huge of data i/o and wish to improve performance by decreasing
the number of memory allocation and free, maybe consider memory pool or
object pool.
what is your i/o data rate in your program? could you give some hint about
that? |
h****e 发帖数: 2125 | 3 have tried s11n?
【在 w***g 的大作中提到】 : 我知道placement new可以从给定的内存中创建对象,但是replacement new会重新初始 : 化对象。不知道c++中有没有什么idiom可以从buffer直接创建对象。或许强制类型转化 : 可以work,但是心里老觉得不舒服。我的目的是通过mmap来存取对象,从而达到最高的 : I/O速度。这也是没办法,数据太多以至于I/O成了bottleneck。我知道post++有这个功 : 能,但是post++已经好几年都没有更新了。boost支持serialization,但是查了一下 : forum发现性能并不是最好。如果有高人知道别的可以通过mmap来实现object : persistency的软件也请告知。
|
n*w 发帖数: 3393 | 4 一直有个疑问,c++做到这些东西时是不是要考虑java 或 c#了? |