Yup, that seems to be it. I would have thought that init(capacity:) should
work, too (it could defer allocation until, say, the call
withUnsafeMutableBytes()), and just not zero the contents (the init(count:)
call zeroes the contents).
> On Apr 25, 2017, at 15:20 , Philippe Hausler wrote:
>
>
> On Apr 25, 2017, at 2:57 PM, Rick Mann via swift-users
> wrote:
>
> I'm trying to pass a Data of allocated size to a C function for it to fill in:
>
>
> lib_example_call(_ params: UnsafePointer!, _ data:
> UnsafeMutableRawPointer!)
>
> ...
> {
>self.dataBuffer = Data(capacity: BufferS
I'm trying to pass a Data of allocated size to a C function for it to fill in:
lib_example_call(_ params: UnsafePointer!, _ data:
UnsafeMutableRawPointer!)
...
{
self.dataBuffer = Data(capacity: BufferSizeConstant)
var params = lib_call_params_t();
params.data_capacity = BufferSize
Can you share the code for your benchmark?
Slava
> On Apr 25, 2017, at 6:34 AM, Proyb P via swift-users
> wrote:
>
> I have testing the performance between trunk builds downloaded from Swift
> website (April 22 and 24) and 3.1.1
>
> Fibonacci (N: 50) benchmark:
> Trunk (22 Apr): 1m13s
> Trun
On Mon, Dec 5, 2016 at 9:28 AM Joe Groff via swift-users <
swift-users@swift.org> wrote:
>
> On Dec 4, 2016, at 4:53 PM, Andrew Trick via swift-users <
> swift-users@swift.org> wrote:
>
>
> On Nov 30, 2016, at 5:40 AM, Anders Ha via swift-users <
> swift-users@swift.org> wrote:
>
> Hi guys
>
> I h
I have testing the performance between trunk builds downloaded from Swift
website (April 22 and 24) and 3.1.1
Fibonacci (N: 50) benchmark:
Trunk (22 Apr): 1m13s
Trunk (24 Apr): 1m16s
3.1.1: 1m7s
I assume there are overhead in trunk build? There is a big regression.
___
Do you know if that will include a backend for grandcentral to support
epoll instead of kqueue/kevent? The later is not supported on many linux
distros.
I wish swift supported fedora directly instead of all the hacks i have to
do to get it to work.
On Tue, Apr 25, 2017, 00:21 Proyb P via swift-us
What about `withUnsafeMutablePointer` on a stored object property, marked with
`final`? e.g. `withUnsafeMutablePointer(to: &object.lock, os_unfair_lock_lock)`.
The generated object code with `-Owmo` shows that it is optimised to an address
calculation immediately followed by a call to `os_unfair
On 25.04.2017 12:24, Rick Mann via swift-users wrote:
Not the ResultType, you mean, but the input type, right?
Yes, sorry, I meant ContentType.
Yeah, I finally figured that out, although it doesn't explain another situation
I'm experiencing that I didn't include in the post.
However, that d
Not the ResultType, you mean, but the input type, right? Yeah, I finally
figured that out, although it doesn't explain another situation I'm
experiencing that I didn't include in the post.
However, that doesn't explain why it can't infer it in the last example.
> On Apr 25, 2017, at 02:58 , Ole
The withUnsafeMutableBytes method has two generic parameters, ResultType
and ContentType:
|mutating func withUnsafeMutableBytes(_ body:
(UnsafeMutablePointer
)
throws -> ResultType) rethrows -> ResultType|
In your examples, the type checker can't infer the type of ResultType.
You'll have
The following playground reproduces an issue I'm having, in that the code won't
compile depending on the content of the closure. In fact, an empty closure is
fine, but when I try to call certain things, it's not.
I figure it has something to do with the type inference for inPointer, but I
can't
12 matches
Mail list logo