|
|
|
[
Permlink
| « Hide
]
Charles Oliver Nutter - 20/Mar/08 01:53 AM
This looks very promising, for this and for any other structs we might need to work with. And we certainly could use perf improvements for stat.
wow...300% is great. Can you specify which issues may remain with this patch that may need changing? Also BaseHeapFileStat is not in the patch.
Not sure what may need changing - its mainly that it hasn't been tested much at all - it was just a backport of some stuff I was using to bench jffi vs jna.
A few things come to mind: I'd like to see if anyone else can reproduce the benchmark results too. The delta does not match what I was getting with non-jruby benchmarks. Stock JRuby (1.1RC2) JRuby with HeapStruct: A small patch to do arrays of struct members.
Cool. Many more array paddings in solaris heap struct. I will update to use this new method.
This was implemented in jna-posix 0.5 and went out with jruby-1.1.1
I think the performance has more to do with writing the dozens of fields in the stat structure on each function call rather than whether you use com.sun.jna.Memory or NIO buffers. Note that Structure.write is called for every structure argument prior to a function call, and Structure.read called afterward. This makes it easy to use structures without having to always remember to do a write/read.
Since the stat structures already wrap each field with setters and getters, you could probably get similar performance by overriding Structure.write/ to do nothing (to avoid the automatic write) and using Structure.writeField() after each field update. In some situations, an annotation might be useful to avoid the automatic write or read. For specific performance tuning, it probably comes down to making native reads/writes for only those fields you know are changing. Maybe the Structure instance itself could have a flag to indicate whether auto-read/write behavior is desired. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||